Status update 11th March 2012
Looks like storage objects will be making an appearance in a Warzone near you sometime in the future
See: http://forums.wz2100.net/viewtopic.php?f=35&t=8756&start=150#p97205 for details.
Overview
I'm becoming increasingly convinced that storing JS state in .ini files is the wrong direction to be taking.
...
- Values can be any data type supported by JSON (in a browser, they'd have to be strings). Supported object types are currentlyJSON currently has native support for:
- Object
- Array
- String
- Boolean
- Number
- Null
- I've added toJSON() and fromJSON() methods.
...
After sessionStorage.js is included in the JS environment, the contents of the playerX_sessionStorage.js file are loaded and then pumped in via sessionStorage.fromJSON(data) (where 'data' is the string representation of the contents of the playerX_sessionStorage.js file).
That's it.
Future development:
...
localStorage
If the sessionStorage idea proposed above gets accepted, then an obvious next-step would be to implement localStorage.
...
Inside the localStorage.setItem() method, it would do the normal stuff - in other words update its own internal data object. But then it would also call setLocalStorage(me,key,JSON.stringify(val))
When setLocalStorage is called, the C++ code would do something like this:
...