import LocalStorageUtility from 'clinical6/src/utilities/StorageUtility.localStorage.js'
LocalStorageUtility
Storage will store and retrieve data. This is expected to have set and get methods overwritten if necessary.
Example:
import { Storage } from 'clinical6';
Storage.set('kittens', 5);
Storage.get('kittens');
Static Member Summary
Static Public Members | ||
public static |
|
|
public static get |
Get the instance of the storage utility |
Constructor Summary
Public Constructor | ||
public |
constructor(enforcer: Symbol) Constructor |
Method Summary
Public Methods | ||
public |
Clear storage data. |
|
public |
Get storage data. |
|
public |
Determines if the type and id exist in storage |
|
public |
Set storage data. |
Static Public Members
Public Constructors
Public Methods
public clear(type: String, id: String): Promise<any> source
Clear storage data.
Throw:
If type is not a string |
Example:
import { Storage } from 'clinical6';
Storage.clear('kittens');
Storage.clear();
public get(type: String, options: Object): Promise<any> source
Get storage data.
Params:
Name | Type | Attribute | Description |
type | String |
|
Type/Key of item to get - should be server's obj type |
options | Object |
|
Options for getting storage information |
options.id | String |
|
The id, if you want to store a specific item |
options.asArray | String |
|
Return as array |
Throw:
If type is empty or not a string |
Example:
import { Storage } from 'clinical6';
Storage.get('kittens');
public set(type: String, value: String, options: Object): Promise<any> source
Set storage data.
Params:
Name | Type | Attribute | Description |
type | String |
|
Type/Key of item to store - should be server's obj type |
value | String | Value of item to store |
|
options | Object |
|
Options for setting storage information |
options.id | String |
|
The id, if you want to store a specific item |
options.key | String |
|
The key, if you want to store a specific key. Only used if value is an array |
Throw:
If key/value is empty or not a string |
Example:
import { Storage } from 'clinical6';
Storage.set('kittens', 5);