Quartz Storage is meant to be a simple and safe cross browser/platform storage for games. It makes use of localStorage when possible and falls back to cookies when localStorage is not accesible.
Storage can be namespaced so you can use same key values amonst different games/pages on the same site
First you'd want to include the library in your page by doing the following:
Setup a namespace
The storage objects in Quartz Storage are by default all grouped in a Quartz: namespace. If you would like a different (game specific) namespace, you can just get an instance and set the namespace.
Set/Get an item
Setting and getting of items is as straightforward as ever:
Keep in mind that due to localStorage all keys and values should be string!
var s = QuartzStorage;s;var num = s;s === 162; //false=== 162; //true
- Fixed an issue with the CookieStorage where values would have ';' appended to them
- Added noImplicitAny
- package rename to match npm's requirements