@Lubos
Nice, that’s even easier than I’d have thought!
@the_beginner
I’ve made a quick example based on Lubos’ call_js example file. Basically, it’s as easy as adding a little library file in a bundled folder and adding a bit in the haxe file:
-
Add the small js library in the bundled folder (you can also just include it in the actual CallJS.hx file, but I’ve always found escaping characters a nightmare to work with).
-
Edit the CallJS file with the code shown in step 3.
-
This part of code loads the saving function from the “SavingFunctionLibrary.js” (inspired from here) and in this section you can choose your own file name (green) and your save data (blue), your save data can just be escaped to be a haxe variable containing your save data from your game etc.
-
Click on the cube from Lubos’ initial example file, and you’ll now get a save prompt, allowing your users to save their data - This should work with most browsers supporting the W3C standards/api/and-so-on…:
I’ve attached the file as an example below:
I’ll probably add an example with PHP and SQL on how to save data to a server at a later stage.