編輯

共用方式為


IAsyncStorage interface

Methods

containsKey(string)

Returns true or false if the given key is present in the cache.

getItem(string)

Get the item from the asynchronous storage object matching the given key.

getKeys()

Get all the keys from the asynchronous storage object as an iterable array of strings.

removeItem(string)

Removes the item in the asynchronous storage object matching the given key.

setItem(string, T)

Sets the item in the asynchronous storage object with the given key.

Method Details

containsKey(string)

Returns true or false if the given key is present in the cache.

function containsKey(key: string): Promise<boolean>

Parameters

key

string

Returns

Promise<boolean>

getItem(string)

Get the item from the asynchronous storage object matching the given key.

function getItem(key: string): Promise<T | null>

Parameters

key

string

Returns

Promise<T | null>

getKeys()

Get all the keys from the asynchronous storage object as an iterable array of strings.

function getKeys(): Promise<string[]>

Returns

Promise<string[]>

removeItem(string)

Removes the item in the asynchronous storage object matching the given key.

function removeItem(key: string): Promise<void>

Parameters

key

string

Returns

Promise<void>

setItem(string, T)

Sets the item in the asynchronous storage object with the given key.

function setItem(key: string, value: T): Promise<void>

Parameters

key

string

value

T

Returns

Promise<void>