- Source:
Methods
get(key) → {string|null
|boolean}
#
null
|boolean}
#
Retrieve value from device storage.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Key of item to retrieve |
- Source:
Returns:
String value, null if no value exists, or false if storage is not available.
- Type
-
string
|
null
| boolean
getObject(key) → {Object|null
|boolean}
#
null
|boolean}
#
Retrieve JSON object from device storage.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Key of item to retrieve |
- Source:
Returns:
Object, null if no value exists or value is not JSON-parseable, or false if storage is not available.
- Type
-
Object
|
null
| boolean
remove(key) → {boolean}
#
Remove a value from device storage.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Key of item to remove |
- Source:
Returns:
Whether the key was removed
- Type
- boolean
set(key, value, expiryopt) → {boolean}
#
Set a value in device storage.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
string | Key name to store under |
|
value |
string | Value to be stored |
|
expiry |
number |
<optional> |
Number of seconds after which this item can be deleted |
- Source:
Returns:
The value was set
- Type
- boolean
setExpires(key, expiryopt) → {boolean}
#
Set the expiry time for an item in the store.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
string | Key name |
|
expiry |
number |
<optional> |
Number of seconds after which this item can be deleted, omit to clear the expiry (either making the item never expire, or to clean up when deleting a key). |
- Source:
Returns:
The expiry was set (or cleared) [since 1.41]
- Type
- boolean
setObject(key, value, expiryopt) → {boolean}
#
Set an object value in device storage by JSON encoding.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
string | Key name to store under |
|
value |
Object | Object value to be stored |
|
expiry |
number |
<optional> |
Number of seconds after which this item can be deleted |
- Source:
Returns:
The value was set
- Type
- boolean