BrowserStorage
Namespace: Wisej.Core
Assembly: Wisej.Framework (4.1.0.0)
Represents the browser's storage objects.
- C#
- VB.NET
public class BrowserStorage : IWisejSynchronized
Public Class BrowserStorage
Inherits IWisejSynchronized
Methods
Clear()
Removes all the values from the browser's storage.
GetKeys(callback)
Returns all the keys in the browser's storage.
| Parameter | Type | Description |
|---|---|---|
| callback | Action<String[]> | Callback method that receives each key name asynchronously. |
GetKeysAsync()
Asynchronously returns all the keys in the browser's storage.
Returns: Task<String[]>. An awaitable Task that represents the asynchronous operation.
GetValue<T>(key, callback)
Returns the value stored in the browser's storage associated with the specified key .
| Parameter | Type | Description |
|---|---|---|
| T | Type of the value to retrieve. | |
| key | String | Key associated with the value to retrieve. |
| callback | Action<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:
- ArgumentNullException The key is null or empty, or callback is null.
GetValueAsync<T>(key)
Asynchronously returns the value stored in the browser's storage associated with the specified key .
| Parameter | Type | Description |
|---|---|---|
| T | Type of the value to retrieve. | |
| key | String | Kay associated with the value to retrieve. |
Returns: Task<T>. An awaitable Task that represents the asynchronous operation.
RemoveValue(key)
Removes the value associated with the key from the browser's storage.
| Parameter | Type | Description |
|---|---|---|
| key | String | Kay associate with the value to remove. |
SetValue<T>(key, value)
Stores the specified value in the browser's storage.
| Parameter | Type | Description |
|---|---|---|
| T | Type of the value to store. | |
| key | String | Key associated with the value. |
| value | T | Value to store in the browser's storage. |
Inherited By
| Name | Description |
|---|---|
| LocalStorage | Represents the browser's localStorage. Use this class through the Browser instance. |
| SessionStorage | Represents the browser's localStorage. Use this class through the Browser instance. |
| CookieStorage | Represents the browser's cookie storage. Use this class through the Browser instance. |