ScriptCraft
ScriptCraft copied to clipboard
Document the `persist()` function with examples.
https://github.com/walterhiggins/ScriptCraft/blob/development/src/main/js/lib/persistence.js#L18
Example usage
// read data
var data = persist('nanocode')
// write data
data.new = 'Some more data'
persist('nanocode', data, true)
The third parameter of persist()
: If it is true
, it is a write. If it is not there, or is false
, it is a read.
Function signature
/* Load data from persistence */
declare function persist(key: string): object
declare function persist(key: string, data: object): object
/* Write data to persistence */
declare function persist(key: string, data: object, write: true): object