Interface WebStorage
entries<T>(regex?: RegExp): IterableIterator<[string, Writable<T>], any, any>;
getItem(key: string, defaultValue?: any): unknown;
getStore<T>(key: string, defaultValue?: T, storageStores?: StorageStores): Writable<T>;
hasStore(key: string): boolean;
keys(regex?: RegExp): IterableIterator<string, any, any>;
setItem(key: string, value: any): void;
stores<T>(regex?: RegExp): IterableIterator<Writable<T>, any, any>;
swapItemBoolean(key: string, defaultValue?: boolean): boolean;
}
Implemented by
Methods
entries
- entries<T>(regex?): IterableIterator<[string, Writable<T>], any, any>
Type Parameters
Parameters
Optional
regex: RegExpOptional regular expression to filter by storage keys.
Returns IterableIterator<[string, Writable<T>], any, any>
Iterable iterator of keys and stores.
getItem
getStore
- get
Store <T>(key, defaultValue?, storageStores?): Writable<T> Returns the backing Svelte store for the given key; potentially sets a default value if the key is not already set.
Type Parameters
Parameters
- key: string
Key to lookup in storage API.
Optional
defaultValue: TA default value to return if key not present in session storage.
Optional
storageStores: StorageStoresAdditional store creation options.
Returns Writable<T>
The Svelte store for this key.
- key: string
hasStore
keys
- keys(regex?): IterableIterator<string, any, any>
Returns an iterable for the session storage keys from existing stores.
Parameters
Optional
regex: RegExpOptional regular expression to filter by storage keys.
Returns IterableIterator<string, any, any>
Iterable iterator of session storage keys.
setItem
stores
- stores<T>(regex?): IterableIterator<Writable<T>, any, any>
Type Parameters
Parameters
Optional
regex: RegExpOptional regular expression to filter by storage keys.
Returns IterableIterator<Writable<T>, any, any>
Iterable iterator of stores.
swapItemBoolean
- swap
Item (key, defaultValue?): booleanBoolean Convenience method to swap a boolean value stored in storage API updating the associated store value.
Parameters
- key: string
Key to lookup in storage API.
Optional
defaultValue: booleanA default value to return if key not present in session storage.
Returns boolean
The boolean swap for the given key.
- key: string
Provides the TRL web storage store API.