Constructor
new SharedPreferences()
Example
// Write & Read any
SharedPreferences.write("test_key", "test_value");
const value = SharedPreferences.read("test");
console.log(value);
Methods
(static) read(key) → {any}
Reads the value associated with the specified key from disk.
Parameters:
Name | Type | Description |
---|---|---|
key | string | The key to read the value from. |
Returns:
- The value associated with the key, or null if the key does not exist.
- Type:
- any
(static) write(key, value)
Writes the specified value to disk with the given key.
Parameters:
Name | Type | Description |
---|---|---|
key | string | The key to associate the value with. |
value | any | The value to write to disk. |