Wocart

@wocart/storefront v3.1.0


@wocart/storefront / index / BasketStorageAdapter

Interface: BasketStorageAdapter

Storage adapter abstraction.

Allows zero-browser operation (in-memory for unit tests / SSR) and safe degradation when localStorage is blocked (cookies disabled, private mode).

Methods

getItem()

getItem(key): string

Parameters

key

string

Returns

string


isAvailable()

isAvailable(): boolean

Returns

boolean


removeItem()

removeItem(key): void

Parameters

key

string

Returns

void


setItem()

setItem(key, value): void

Parameters

key

string

value

string

Returns

void


subscribe()?

optional subscribe(onExternalChange): () => void

Parameters

onExternalChange

() => void

Returns

() => void