API Reference
Adapter Contract
Reference for NusmAdapter, browser adapter options, events, and pacing.
Built-in adapter factories
function createLocalStorageAdapter(
options?: StorageAdapterOptions,
): NusmAdapter
function createSessionStorageAdapter(
options?: StorageAdapterOptions,
): NusmAdapter
function createIndexDbAdapter(
options?: IndexDbAdapterOptions,
): NusmAdapterNusmAdapter
Prop
Type
AdapterEvent
type AdapterEventType = "set" | "remove" | "clear"Prop
Type
Provide a key for set and remove. An adapter-wide clear can omit it.
NusmPacerConfig
type NusmPacerConfig =
| false
| {
wait?: number
maxWait?: number
leading?: boolean
trailing?: boolean
}false bypasses the debouncer. The current runtime forwards wait, leading, and trailing to the AsyncDebouncer; maxWait remains in the public type but is not forwarded yet.
StorageAdapterOptions
Used by createLocalStorageAdapter and createSessionStorageAdapter:
Prop
Type
StorageLike
Prop
Type
key and length enable getAllKeys; clear enables adapter clearing.
IndexDbAdapterOptions
Prop
Type
See Custom Adapters for implementation guidance and invariants.