localValue

Stores and retrieves local values, like settings or something, that you want to have persistent on this specific browser. The value will be saved only for the browser you are currently working on. The value will be save in the scope of the current workspace you are working in.

Parameters

  1. key - Key name

  2. value - (optional) value you want to save. If this is empty, Gebra Suite will return the value, you saved before.

This is not an asynchronous operation. No await needed!

Example Usages

app.localValue("myKey", "Hello World"); //Save the value "Hello World" under the key "myKey"
let x = app.localValue("myKey"); //Retrieve the Key "myKey". This will result in "Hello World"

console.log(x);

Return Values

The localValue function is a getter and setter for values in the localStorage. It has two modes of operation.

  1. Setter Mode: If the value parameter is provided (not undefined), it sets the value associated with the specified key in the localStorage and returns undefined.

  2. If the value parameter is undefined, it retrieves the value associated with the specified key from the localStorage and returns that value.

If value is provided, it is a setter, and the function returns undefined.

If value is undefined, it is a getter, and the function returns the value associated with the specified key from the localStorage.

Last updated