React Native Storage - v2.0.0
    Preparing search index...

    Interface SyncStorageDriver

    interface SyncStorageDriver {
        name: string;
        maxValueBytes?: number;
        subscribe?(listener: (key: string | null) => void): () => void;
        sync: true;
        getItem(key: string): string | null;
        setItem(key: string, value: string): void;
        removeItem(key: string): void;
        getAllKeys?(): readonly string[];
    }

    Hierarchy

    • DriverBase
      • SyncStorageDriver
    Index
    name: string

    Human-readable name used in error messages, for example "mmkv".

    maxValueBytes?: number

    The largest value, in UTF-8 bytes, this backend stores reliably. The storage uses the smaller of this and its own maxValueBytes.

    sync: true
    • Calls listener with the full key when a value changes outside this storage, for example through the same MMKV instance or in another browser tab; null means every key may have changed. Returns a function that stops listening.

      Parameters

      • listener: (key: string | null) => void

      Returns () => void

    • Parameters

      • key: string

      Returns string | null

    • Parameters

      • key: string
      • value: string

      Returns void

    • Parameters

      • key: string

      Returns void

    • Every key in the backend. Optional: without it, keys() and clear() throw UNSUPPORTED.

      Returns readonly string[]