Browser storage manager
WebStorage(storageType: StorageType)
Returns an integer representing the number of data items stored in the Storage object.
storageType: StorageType
Type of browser storage this instance manages.
Reference to the browser Storage object for this instance's StorageType.
clear(): void
Removes all keys/value pairs from the storage instance.
When passed a key name, will return that key's value, or null
if the key does not exist.
removeItem(key: string): void
Removes a key/value pair from the storage instance if it exists.
_local: WebStorage | null
Local storage singleton.
_session: WebStorage | null
Session storage singleton.
create(storageType: StorageType): WebStorage
Creates a new WebStorage instance for the given StorageType.
Gets the WebStorage instance for the StorageType.Local storage type.
Gets the WebStorage instance for the StorageType.Session storage type.
isAvailable(storage: Storage): boolean
Tests whether a given StorageType is available in the current context.
Tests whether StorageType.Local is available in the current environment. This determines whether self.localStorage can be used without throwing errors.
Tests whether StorageType.Session is available in the current environment. This determines whether self.sessionStorage can be used without throwing errors.