Storage

Persistent storage.

Permission

my-plugin.json
{
    //...
    "plugin": {
        "permissions": {
            "scopes": ["storage"]
        }
    }
}

Usage

API

Unlike store , storage handles nested values out of the box.

$storage.set("foo.bar", 1)
$storage.set("foo.baz", "2")

$storage.has("foo") // true

$storage.get<number>("foo.bar") // 1
$storage.get<Record<string, any>>("foo") // { "bar": 1, "baz": "2" }

$storage.set("foo", "bar")
$storage.get("foo") // bar

$storage.watch("foo", (value) => {})

Example

Good to know

The plugin storage is deleted when the plugin is uninstalled.

Last updated