> ## Documentation Index
> Fetch the complete documentation index at: https://bym.lonestill.uk/llms.txt
> Use this file to discover all available pages before exploring further.

# api.Storage

> Постоянное хранилище ключ-значение, изолированное по plugin ID

Данные сохраняются через `localStorage`. Каждый плагин работает в своём неймспейсе.

## Методы

```js theme={null}
api.Storage.set(key, value)  // сохранить; value — любой JSON-тип
api.Storage.get(key)         // → value | null
```

`get` возвращает `null` если ключ не существует.

## Поддерживаемые типы

```js theme={null}
api.Storage.set('obj',  { x: 1, arr: [1, 2, 3] });
api.Storage.set('num',  3.14);
api.Storage.set('bool', false);
api.Storage.set('str',  'hello');
```

## Настройки плагина

Настройки из `meta.settings` хранятся под ключом `{pluginId}.{key}`. Читать удобнее через `getSetting`:

```js theme={null}
// эквивалентно:
getSetting('myKey')
api.Storage.get('my-plugin-id.myKey')
```

## Пример

```js theme={null}
BYM.register({ id: 'counter' }, (api) => ({
  start() {
    const count = (api.Storage.get('launches') ?? 0) + 1;
    api.Storage.set('launches', count);
    api.Logger.log(`Запуск №${count}`);
  },
  stop() {},
}));
```
