-
-
Notifications
You must be signed in to change notification settings - Fork 16
Home
As an interface for the HTML5 localStorage API, localDataStorage
1) 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.
Array Keys:
push / pull, pullall poke contains where
Broadcasting:
broadcast
Data Transfer:
import / export
Duplicates:
countdupes, showdupes, listdupes
Internals:
cancrunch crunch / uncrunch
shufflestring / unshufflestring
Management:
keys
Memory Consumption:
Memory Quota:
showquota
Query:
haskey, hasval, hastype
setscramblekey / getscramblekey
Type Check:
isarray isbigint isboolean iscrunch
isdate isfloat isinteger isnull
Utility:
chopget copy softset rename
_set / _get _clear _key _remove
Management:
_keys
Type Check:
_isarray _isbigint _isboolean _iscrunch