I have tried to see if there are any examples, or samples, or documentation about the cocoonjs and local storage. But to no avail.
If I go look at the feature list all that they have is the following for localStorage:
I am unsure if this is going to remain on the device after the game has closed, or if anyone has another or better way to save device specific game data?
Knowing the guys at Ludei and Scirra, this could be in development for the next build.
Ooh, I'd like to know this too. Haven't come to this part in the program yet, but it's always good to know.
Have you tried it? Just add the Webstorage object and store something in local storage.
Develop games in your browser. Powerful, performant & highly capable.
This tutorial covers a lot of important imformation about exporting to Cocoonjs, but it might not be updated every time Construct updates.
If WebStorage doesn't work for you, the Dictionary feature may be a nice substitute.
Ash, will give it a try. Thanks.
I added the local storage object and tested it out with cocoonJS. Works perfectly.
Hello superkew i using webstorage and my game for cocoonJS have this events but on webstorage. I wonder how looks like events created to LocalStorage?
The WebStorage object uses a very simple storage model: values are stored under named keys, similar to how the Dictionary object works. For example, the value 100 could be stored for the key score with the action Set local value "score" to 100. Similarly the value John can be stored for the key name. Then the expression WebStorage.LocalValue("score") returns "100" (as a string) and WebStorage.LocalValue("name") returns "John", and these values persist between sessions. (If session storage was used instead, the values would only last as long as the browser session.)
Note WebStorage only stores strings. If you set a key to a number like 100, when you retrieve it back it will be a string. To convert it back, use the system expression int, e.g. int(WebStorage.LocalValue("score")).