-
-
Notifications
You must be signed in to change notification settings - Fork 15
Getting Started
The code is contained in one JavaScript file, which creates a single constructor function called localDataStorage in the global scope.
To use localDataStorage--
- bring the code into your page (via <script> tags, direct copy, etc.)
- instantiate it with a meaningful prefix
The generic call would look something like localDataStorage( prefix, switch ).
For example:
<script
src="https://cdn.jsdelivr.net/gh/macmcmeans/localDataStorage@1.3.1/localDataStorage-1.3.1.min.js"
integrity="sha384-Rc8gyCOHcneAsNwEsjnQQLQ6JSS0ZBgZxwr2Qh7z4Knfd5O5GLnD5sm6WSCYKv+2"
crossorigin="anonymous"
></script>
<script>
var localData = localDataStorage( 'passphrase.life' );
</script>
At this point all key names will have the prefix passphrase.life. prepended to them (note the trailing period), so calling set( 'authorName', 'Mac' ) will store the authorName key as passphrase.life.authorName internally.
To control how localDataStorage starts up, you may use a few switches. You should specify a prefix to prevent storage contamination.
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