Storage

storage/Storage~ Storage

The Storage is an unordered collection of named values of any type. Values in the storage are named using string keys. The storage can be therefore thought of as a Map.

Methods

clear() → {Storage}

Source:
Clears the storage of all entries.
Returns:
This storage.
Type
Storage

delete(key) → {Storage}

Source:
Deletes the entry identified by the specified key from this storage.
Parameters:
Name Type Description
key string The key identifying the storage entry.
Returns:
This storage.
Type
Storage

get(key) → {*}

Source:
Retrieves the value of the entry identified by the specified key. The method returns undefined if the entry does not exists. Entries set to the undefined value can be tested for existence using the has method.
Parameters:
Name Type Description
key string The key identifying the storage entry.
Returns:
The value of the storage entry.
Type
*

has(key) → {boolean}

Source:
Returns true if the entry identified by the specified key exists in this storage.
Parameters:
Name Type Description
key string The key identifying the storage entry.
Returns:
true if the storage entry exists.
Type
boolean

init() → {Storage}

Source:
This method is used to finalize the initialization of the storage after the dependencies provided through the constructor have been prepared for use. This method must be invoked only once and it must be the first method invoked on this instance.
Returns:
This storage.
Type
Storage

keys() → {Iterator.<string>}

Source:
Returns an iterator for traversing the keys in this storage. The order in which the keys are traversed is undefined.
Returns:
An iterator for traversing the keys in this storage. The iterator also implements the iterable protocol, returning itself as its own iterator, allowing it to be used in a for..of loop.
Type
Iterator.<string>

set(key, value) → {Storage}

Source:
Sets the storage entry identified by the specified key to the provided value. The method creates the entry if it does not exist already.
Parameters:
Name Type Description
key string The key identifying the storage entry.
value * The storage entry value.
Returns:
This storage.
Type
Storage

size() → {number}

Source:
Returns the number of entries in this storage.
Returns:
The number of entries in this storage.
Type
number