Storage
Kind: global interface
storage.init() ⇒ Storage
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.
Kind: instance method of Storage
Returns: Storage
- This storage.
storage.has(key) ⇒ boolean
Returns true
if the entry identified by the specified key exists
in this storage.
Kind: instance method of Storage
Returns: boolean
- true
if the storage entry exists.
Param | Type | Description |
---|---|---|
key | string |
The key identifying the storage entry. |
storage.get(key) ⇒ \*
Retrieves the value of the entry identified by the specified . 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.
Kind: instance method of Storage
Returns: \*
- The value of the storage entry.
Param | Type | Description |
---|---|---|
key | string |
The key identifying the storage entry. |
storage.set(key, value) ⇒ Storage
Sets the storage entry identified by the specified key to the provided value. The method creates the entry if it does not exist already.
Kind: instance method of Storage
Returns: Storage
- This storage.
Param | Type | Description |
---|---|---|
key | string |
The key identifying the storage entry. |
value | \* |
The storage entry value. |
storage.delete(key) ⇒ Storage
Deletes the entry identified by the specified key from this storage.
Kind: instance method of Storage
Returns: Storage
- This storage.
Param | Type | Description |
---|---|---|
key | string |
The key identifying the storage entry. |
storage.clear() ⇒ Storage
Clears the storage of all entries.
Kind: instance method of Storage
Returns: Storage
- This storage.
storage.keys() ⇒ Iterator.<string>
Returns an iterator for traversing the keys in this storage. The order in which the keys are traversed is undefined.
Kind: instance method of Storage
Returns: Iterator.<string>
- 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.
storage.size() ⇒ number
Returns the number of entries in this storage.
Kind: instance method of Storage
Returns: number
- The number of entries in this storage.