WXT Storage

wxt · database, Database / ORM

Simplified, typed wrapper around browser.storage APIs with reactive-like interface for managing extension state.

// Source: https://github.com/wxt-dev/wxt | License: MIT | Copyright 2023 Aaron
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Simplified storage APIs with support for versioned fields, snapshots,
 * metadata, and item definitions.
 *
 * See [the guide](https://wxt.dev/storage.html) for more information.
 *
 * @module @wxt-dev/storage
 */
import { browser, type Browser } from '@wxt-dev/browser';
import { withLock } from 'superlock';
import { dequal } from 'dequal/lite';

export const storage = createStorage();

function createStorage(): WxtStorage {
  const drivers: Record<StorageArea, WxtStorageDriver> = {
    local: createDriver('local'),
    session: createDriver('session'),
    sync: createDriver('sync'),
    managed: createDriver('managed'),
  };

  const getD

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key