Home - macmcmeans/localDataStorage GitHub Wiki
As an interface for the HTML5 localStorage API, localDataStorage1) lets you set and get keys that respect native data types without having to perform your own conversion;2) provides simple data scrambling;3) intelligently compresses string data; 4) permits query by key (name) as well as query by (key) value; 5) facilitates shared storage segmentation in the same domain; 6) broadcasts change events across the origin for the benefit of other windows/tabs; and 7) offers Memory Keys for the fastest read times possible.
Array Keys are a dedicated key type making it easy to work with array data in localStorage.
Because JavaScript is running in a single thread in the browser, there are no race conditions or concerns with atomicity using localDataStorage. Further, all methods are synchronous. (Obviously, this is not referring to node.js, where single-threaded JavaScript is running on a server; or web workers, where multiple processes are running in a single thread.)
Both the keyname and its value are case-sensitive. With 80+ total methods and properties, the localDataStorage wrapper can be considered a superset of web storage, and when things change, it conveniently fires its own events.
Data created under this software is generally incompatible with the HTML5 localStorage API. Keys can still be read (using getItem), but since localDataStorage handles so much more than just strings, the returned values won't make much sense using the native API.
As with localStorage, key names in localDataStorage are unique, key values are not. Duplicate values are easily discovered.
The process of storing and retrieving data to and from localStorage isn't actually slow, but it cannot compare to memory. When your use-case demands the fastest read times, you can employ Memory Keys for the best performance.
If you'd like to know what goes on under the hood, see the details on memory usage.
When you're ready to include this in your next project, it's easy to get started.