Skip to content

Getting Started

W. "Mac" McMeans edited this page May 3, 2020 · 44 revisions

The code is contained in one JavaScript file, which creates a single constructor function called localDataStorage in the global scope.

To use localDataStorage--

  1. bring the code into your page (via <script> tags, direct copy, etc.)
  2. instantiate it with a meaningful prefix

The generic call would be something like this: localDataStorage( prefix, switch );

For example:

<script src="localDataStorage-1.3.0.min.js"></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 may also specify the storage key prefix.

localStorage Keys

The usual suspects:

set / get      clear      key      remove

The esoteric ones:

Array Keys:
push / pull, pullall      poke      contains      where

Broadcasting:
broadcast

Bypass:
forceset / forceget

Data Transfer:
import / export

Duplicates:
countdupes, showdupes, listdupes

Internals:
cancrunch      crunch / uncrunch

shufflestring / unshufflestring

xorstring

Management:
keys

Memory Consumption:

Memory Quota:
showquota

Query:
haskey, hasval, hastype

Security:
safeset / safeget

setscramblekey / getscramblekey

Type Check:
isarray      isbigint      isboolean      iscrunch

isdate      isfloat      isinteger      isnull

isnumber      isobject      isstring

showtype

Utility:
chopget      copy      softset      rename

Properties:

channel      length      quota      version

Settings:

verbosity

Memory Keys

Standard:

_set / _get      _clear      _key      _remove

Unconventional:

Data Sync:
_backup / _restore

Management:
_keys

Security:
_safeset / _safeget

Type Check:
_isarray      _isbigint      _isboolean      _iscrunch

_isdate      _isfloat      _isinteger      _isnull

_isnumber      _isobject      _isstring

_showtype

Utility:
_chopget      _copy      _softset      _rename

Clone this wiki locally