Constructor
new StorageWrap(storageType)
Parameters:
Name | Type | Description |
---|---|---|
storageType |
Object | 存储类型。 |
- Source:
Methods
get(key) → {string}
获取指定存储项的值。
Parameters:
Name | Type | Description |
---|---|---|
key |
string | 存储项键名。 |
- Source:
Returns:
存储项的值。
- Type
- string
getAsJSON(key) → {Any}
获取指定存储项的值并解析为 JSON。
Parameters:
Name | Type | Description |
---|---|---|
key |
string | 存储项键名。 |
- Source:
Returns:
解析结果。
- Type
- Any
remove(key)
移除存储项。
Parameters:
Name | Type | Description |
---|---|---|
key |
string | 存储项键名。 |
- Source:
set(key, value) → {boolean}
写入指定存储项的值。
Parameters:
Name | Type | Description |
---|---|---|
key |
string | 存储项键名。 |
value |
Any | 存储项的值。 |
- Source:
Returns:
写入是否成功。
- Type
- boolean
setAsJSON(key, value) → {boolean}
把指定值序列化为 JSON 字符串后写入到指定存储项。
Parameters:
Name | Type | Description |
---|---|---|
key |
string | 存储项键名。 |
value |
Any | 存储项的值。 |
- Source:
Returns:
写入是否成功。
- Type
- boolean