Skip to content
W. "Mac" McMeans edited this page May 2, 2022 · 20 revisions

𝙉𝙀𝙒 𝙆𝙀𝙔
localDataStorage.push( arrayKeyName, value1 [, value2 ...] )

𝙀𝙓𝙄𝙎𝙏𝙄𝙉𝙂 𝙆𝙀𝙔
localDataStorage.push( arrayKeyName, value [, index] )

This method stores value(s) under arrayKeyName, creating a new key if necessary, where the key prefix is prepended to arrayKeyName. As a shortcut for set, this can make a new key which is automatically an Array Key.

This is also used to place value onto an existing arrayKeyName, optionally at the index position. When index is omitted, the element is appended to the Array Key by default. When specified, the index is automatically corrected to prevent sparse arrays.

EXAMPLE:

Create and initialize a new Array Key with values:
● localData.push( 'nicknames', 'Mac', 'Will', 'Bill', 'Tom' ) --> ['Mac', 'Will', 'Bill', 'Tom']

Push a value onto an existing Array Key:
● localData.push( 'nicknames', 'Todd' ) --> ['Mac', 'Will', 'Bill', 'Tom', 'Todd']

Push a value into the second position:
● localData.push( 'nicknames', 'Kay', 2 ) --> ['Mac', 'Kay', 'Will', 'Bill', 'Tom', 'Todd']

🌐 This method may fire an event allowing you to monitor the key change.

✨ The complement to this is pull.

📝 NOTE: This method is specific to Array Keys and will fail if used on any other key type. Multiple values can be set only when making a new key. Pushing values onto an existing key must be done one at a time.

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