A memento represents a storage utility. It can store and retrieve values.

Methods

get<T>(key:String):Null<T>

get<T>(key:String, defaultValue:T):T

Return a value.

Parameters:

key

A string.

Returns:

The stored value or undefined.

keys():ReadOnlyArray<String>

Returns the stored keys.

Returns:

The stored keys.

update(key:String, value:Any):Thenable<Void>

Store a value. The value must be JSON-stringifyable.

Note that using undefined as value removes the key from the underlying storage.

Parameters:

key

A string.

value

A value. MUST not contain cyclic references.