Skip to main content

KClientStorage

kds-plugin-document / Exports / KClientStorage

Interface: KClientStorage

本地浏览器临时存储接口 它类似于 Window.seesionStorage,可用于存储各种自定义数据。清空浏览器缓存会导致数据丢失

The KClientStorage class allows you to store data on the user's local machine. This data is not synchronized across users. It's similar to the Window.sessionStorage, and allows storing objects, arrays, strings, numbers, booleans, null, undefined and Uint8Array. Like sessionStorage, you should expect that user actions such as clearing the browser cache might clear all stored data.

Table of contents

Methods

Methods

getAsync

getAsync(key): HostPromise<any>

根据 key 获取存储内容

Retrieve a value from client storage with the given key.

Parameters

NameTypeDescription
keystringThe given key.

Returns

HostPromise<any>

The value from client storage with the given key.

Defined in

api.d.ts:11259


setAsync

setAsync(key, value): HostPromise<void>

用 <key, value> 的形式存储内容

Set a value to client storage with the given key.

Parameters

NameTypeDescription
keystringThe given key.
valueanyThe given value.

Returns

HostPromise<void>

Defined in

api.d.ts:11270