-
-
Notifications
You must be signed in to change notification settings - Fork 16
Broadcasting
The localDataStorage interface sends custom events locally to the same tab/window in which the storage change event occurred. Yet equally as convenient, it also broadcasts to any other tabs or windows on the same origin via the Broadcast Channel API. In this way, browsing contexts can be kept in sync, if necessary.
The default channel name is localDataStorage and can be renamed using the broadcast method. The channel name is stored in the channel property.
To listen on the channel, use code like this
const myChannel = new BroadcastChannel( 'localDataStorage' );
channel.addEventListener( 'message', (event) => {
console.log( event.data );
});
where the subscriber will receive a JSON detailing the change event:
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