@suluk/nano-stores - v0.1.3
    Preparing search index...

    Interface CartStoreOptions

    interface CartStoreOptions {
        storageKey?: string;
        storage?: Pick<Storage, "getItem" | "setItem"> | null;
        events?:
            | Pick<
                EventTarget,
                "addEventListener"
                | "removeEventListener"
                | "dispatchEvent",
            >
            | null;
        changeEvent?: string;
    }
    Index

    Properties

    storageKey?: string

    localStorage key (default "cart").

    storage?: Pick<Storage, "getItem" | "setItem"> | null

    Persistence backend. Defaults to globalThis.localStorage when present, else an in-memory shim (so the store is usable in SSR/build/tests without throwing). Pass a mock in tests.

    events?:
        | Pick<
            EventTarget,
            "addEventListener"
            | "removeEventListener"
            | "dispatchEvent",
        >
        | null

    Event target for cross-tab + same-tab sync (default globalThis). The store LISTENS for the native storage event (fires in OTHER tabs) and for changeEvent (same tab). Pass null to disable syncing.

    changeEvent?: string

    Same-tab change-notification event name (default "cart-changed"). Non-store writers that mutate the same localStorage key by hand should dispatchEvent(new Event(changeEvent)) after writing, so the store (and the UI it drives) refresh without a reload — the native storage event does NOT fire in the writing tab.