OptionalstorageOptionalstoragePersistence 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.
OptionaleventsEvent 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.
OptionalchangeSame-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.
localStorage key (default "cart").