DLCS LocalStorage Provider
Resource provider for HTML5 localStorage.
Configuration
Name |
Default value |
Usage |
root.local |
'DLCS' |
LocalStorage root name |
SerializableNode.set(StorageProtocol.config, StorageProtocol.configKeys.root.name, 'DLCS');
Supported protocol
-
local
for access localStorage.
Request parameters
No parameter.
Supported mode
Protocol |
Asynchronized |
Synchronized |
Request |
Submit |
Delete |
local |
√ |
√ |
√ |
√ |
√ |
Injectors
Timepoint |
Data structure |
Data description |
Request method |
BeforeSend |
SerializableNode<any> |
Storage node |
Request/Submit/Delete |
AfterSent |
SerializableNode<any> |
Storage node |
Request/Submit/Delete |
Example
resourceManager.registerProtocol(new StorageProtocol());
// Save value
resourceManager.request.to(`local:///user/state/token`).submit('test').tag('user_token').send();
// Read value
const value = resourceManager.request.to(`local:///user/state/token`).tag('user_token_read').requireSync<string>();