Link Search Menu Expand Document

Set method

Sets the key to a new value and updates all subscribed elements.

data.Set(key, value);

Parameters

key: string

The key identifying an object within the global store.

value: object

The payload of to save.

Example

The example saves the value of an input field to the player-field key whenever its value changes:

$("#input-field").addEventListener("input", () => {
    data.Set("player-name", $("#input-field").value);
});