Methods
(static) clear() → {void}
Delete all data saved in the Session storage
- Source
- Type:
- void
Session.clear();
(static) getAll(jsonopt) → {any}
Get all data saved in the Session storage
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
json | boolean | <optional> | false | if true, return the data in json format |
- Source
the data saved in the local storage
- Type:
- any
Session.getAll();
(static) getData(key) → {any}
Get a specific data saved in the Session storage
Name | Type | Description |
---|---|---|
key | string | key of the data to get |
- Source
the data saved in the Session storage
- Type:
- any
Session.getData("myKey");
(static) has(key) → {boolean}
Check if the given key is stored
Name | Type | Description |
---|---|---|
key | string | key to check |
- Source
true if the key is stored
- Type:
- boolean
Session.has("myKey");
(static) isEmpty() → {boolean}
Check if the Session storage is empty
- Source
- true if the Session storage is empty
- Type:
- boolean
Session.isEmpty();
(static) keys() → {Array.<string>}
Get keys of the stored items
- Source
return all keys
- Type:
- Array.<string>
Session.keys();
(static) removeData(key) → {void}
Delete a specific data by name
Name | Type | Description |
---|---|---|
key | sting | the name of the data to delete |
- Source
- Type:
- void
Session.removeData("myKey");
(static) setData(key, value) → {void}
Save/change a specific data by key
Name | Type | Description |
---|---|---|
key | string | name of the key |
value | any | value of the item |
- Source
- Type:
- void
Session.setData("myKeyString", "myString");
Session.setData("myKeyBool", true);
Session.setData("myKeyNumber", 1234567890);
Session.setData("myKeyObject", {name: "Dog", age: 3,});
Session.setData("myKeyArr", [1, 2, 3, 4, 5]);
(static) setName(name) → {void}
Change the name of data saved in the Session storage
Name | Type | Description |
---|---|---|
name | string | the name to save the data in the Session storage |
- Source
- Type:
- void
Session.setName("mySessionStorage");
(static) size() → {number}
Get number of stored items
- Source
number of stored items
- Type:
- number
Session.size();
(static) updateAll(data) → {void}
Save/change all data
Name | Type | Description |
---|---|---|
data | any | data to save |
- Source
- Type:
- void
Session.updateAll({ otherNewData: "Hello World" });