Storage
Provides access to the Web storage. See: https://developer.mozilla.org/en-US/docs/Web/API/Storage
Test:
Constructor Summary
Public Constructor | ||
public |
constructor(backend: Storage) Initializes a new instance of the class. |
Member Summary
Public Members | ||
public get |
The keys of this storage. |
|
public get |
The number of entries in this storage. |
|
public get |
onChanges: Observable<KeyValueChangeRecord[]> The stream of "changes" events. |
Method Summary
Public Methods | ||
public |
Returns a new iterator that allows iterating the entries of this storage. |
|
public |
clear() Removes all entries from this storage. |
|
public |
Gets the value associated to the specified key. |
|
public |
Gets the deserialized value associated to the specified key. |
|
public |
Gets a value indicating whether this storage contains the specified key. |
|
public |
Removes the value associated to the specified key. |
|
public |
Associates a given value to the specified key. |
|
public |
Serializes and associates a given value to the specified key. |
Public Constructors
Public Members
public get onChanges: Observable<KeyValueChangeRecord[]> source
The stream of "changes" events.
Test:
Public Methods
public * [Symbol.iterator]() source
Returns a new iterator that allows iterating the entries of this storage.
public get(key: string, defaultValue: *): string source
Gets the value associated to the specified key.
Params:
Name | Type | Attribute | Description |
key | string | The key to seek for. |
|
defaultValue | * | The default item value if it does not exist. |
Test:
public getObject(key: string, defaultValue: *): * source
Gets the deserialized value associated to the specified key.
Params:
Name | Type | Attribute | Description |
key | string | The key to seek for. |
|
defaultValue | * | The default item value if it does not exist. |
Return:
* | The deserialized value of the storage item, or the default value if the item is not found. |
Test:
public has(key: string): boolean source
Gets a value indicating whether this storage contains the specified key.
Params:
Name | Type | Attribute | Description |
key | string | The key to seek for. |
Test:
public remove(key: string) source
Removes the value associated to the specified key.
Params:
Name | Type | Attribute | Description |
key | string | The key to seek for. |