new Platform Storage()
PlatformStorage use server side storage to permanently store data and allows its retrieval.
Methods
add Change Listener(key, change Listener)
Register change listener for given key of stored data.
Parameters:
Name | Type | Description |
---|---|---|
key |
String | Identifier of stored data. |
changeListener |
Object | Function to be invoked when change of value occurs - will be called with null if no data is available |
delete(key) → {Promise}
Delete value from storage. Also removes all registered listeners for given key and unsubscribes from RECORD subject.
Parameters:
Name | Type | Description |
---|---|---|
key |
String | Identifier of stored data to be deleted. |
Returns:
Promise that will be resolved when operation is completed.
- Type
- Promise
remove Change Listener(key, change Listener)
Unregister change listener for given key of stored data.
Parameters:
Name | Type | Description |
---|---|---|
key |
String | Identifier of stored data. |
changeListener |
Object | Function to be unregistered from listening to change of value. |
save(key, data) → {Promise}
Save value to storage. Record will be created if it does not exist.
Parameters:
Name | Type | Description |
---|---|---|
key |
String | Identifier of data to be stored. |
data |
String | Data to store. |
Returns:
Promise that will be resolved when operation is completed.
- Type
- Promise