WebAdapterOptions
WebAdapterOptions:
object
Defined in: packages/@livestore/adapter-web/src/web-worker/client-session/persisted-adapter.ts:54
Type declaration
clientId?
optional
clientId:string
By default the adapter will initially generate a random clientId (via nanoid(5)
),
store it in localStorage
and restore it for subsequent client sessions. It’s the same across all tabs/windows.
experimental?
optional
experimental:object
experimental.disableFastPath?
optional
disableFastPath:boolean
When set to true
, the adapter will always start with a snapshot from the leader
instead of trying to load a snapshot from storage.
Default
false
resetPersistence?
optional
resetPersistence:boolean
Warning: This will reset both the app and eventlog database. This should only be used during development.
Default
false
sessionId?
optional
sessionId:string
By default the adapter will initially generate a random sessionId (via nanoid(5)
),
store it in sessionStorage
and restore it for subsequent client sessions in the same tab/window.
sharedWorker
sharedWorker: (
options
) =>globalThis.SharedWorker
| (options
) =>globalThis.SharedWorker
This is mostly an implementation detail and needed to be exposed into app code due to a current Vite limitation (https://github.com/vitejs/vite/issues/8427).
In most cases this should look like:
import LiveStoreSharedWorker from '@livestore/adapter-web/shared-worker?sharedworker'
const adapter = makePersistedAdapter({ sharedWorker: LiveStoreSharedWorker, // ...})
storage
storage:
StorageTypeEncoded
Specifies where to persist data for this adapter
worker
worker: (
options
) =>globalThis.Worker
| (options
) =>globalThis.Worker