Interface: StorageInstance
Defined in: storage/create-storage.ts:82
Adds a prefix, subscriptions and error handling to an adapter. A write that changes nothing notifies nobody.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
clear | public | (options?) => void | Removes every key of this instance, except the ones in except. | storage/create-storage.ts:96 |
destroy | public | () => void | Stops listening to changes made outside the instance, and drops every subscription. | storage/create-storage.ts:106 |
getItem | public | (key) => string | null | Returns the raw string under the key, without a parser. | storage/create-storage.ts:87 |
has | public | (key) => boolean | - | storage/create-storage.ts:92 |
keys | public | () => string[] | Returns the keys of this instance, without the prefix. | storage/create-storage.ts:94 |
name | readonly | string | 'local', 'session', 'memory', or the name given to createStorage. | storage/create-storage.ts:84 |
prefix | readonly | string | - | storage/create-storage.ts:85 |
removeItem | public | (key) => void | Removes the entry and notifies the listeners of the key. | storage/create-storage.ts:91 |
setItem | public | (key, value) => void | Writes a raw string and notifies the listeners of the key. | storage/create-storage.ts:89 |
subscribe | public | { (key, listener): Unsubscribe; (listener): Unsubscribe; } | Calls the listener when the key changes, or on every change when given only a listener. Returns the function that stops it. | storage/create-storage.ts:101 |