Skip to main content
Version: 3.5

BrowserStorage

Namespace: Wisej.Core

Assembly: Wisej.Framework (3.5.0.0)

Represents the browser's storage objects.

public class BrowserStorage : IWisejSynchronized

Methods

Instance memberClear()

Removes all the values from the browser's storage.

Instance memberGetKeys(callback)

Returns all the keys in the browser's storage.

ParameterTypeDescription
callbackAction<String[]>Callback method that receives each key name asynchronously.

Instance memberGetKeysAsync()

Asynchronously returns all the keys in the browser's storage.

Returns: Task<String[]>. An awaitable Task that represents the asynchronous operation.

Instance memberGetValue<T>(key, callback)

Returns the value stored in the browser's storage associated with the specified key .

ParameterTypeDescription
TType of the value to retrieve.
keyStringKey associated with the value to retrieve.
callbackAction<T>Callback method that receives the value asynchronously.

This method returns the value asynchronously because it waits for the browser to respond.


Application.LocalStorage.GetValue<string>("userName", (value) => {
if (value != null)
AlertBox.Show($"Welcome back, {value}");
});

Throws:

Instance memberGetValueAsync<T>(key)

Asynchronously returns the value stored in the browser's storage associated with the specified key .

ParameterTypeDescription
TType of the value to retrieve.
keyStringKay associated with the value to retrieve.

Returns: Task<T>. An awaitable Task that represents the asynchronous operation.

Instance memberRemoveValue(key)

Removes the value associated with the key from the browser's storage.

ParameterTypeDescription
keyStringKay associate with the value to remove.

Instance memberSetValue<T>(key, value)

Stores the specified value in the browser's storage.

ParameterTypeDescription
TType of the value to store.
keyStringKey associated with the value.
valueTValue to store in the browser's storage.

Inherited By

NameDescription
LocalStorageRepresents the browser's localStorage. Use this class through the Browser instance.
SessionStorageRepresents the browser's localStorage. Use this class through the Browser instance.
CookieStorageRepresents the browser's cookie storage. Use this class through the Browser instance.