Skip to content
module@warp-drive/experiments/storage

Defined in: storage/storage.ts:122

A reactive wrapper around the Web Storage API (localStorage/sessionStorage) that provides signal-based access to storage items and length.

Will automatically update when storage events occur in other tabs/windows.

Implements

Methods

clear()

ts
clear(): void;

Defined in: storage/storage.ts:315

Clears all keys from Storage, triggering reactivity

Returns

void

Implementation of

ts
Storage.clear

getItem()

ts
getItem(key): null | string;

Defined in: storage/storage.ts:209

Reactive access to Storage contents

Parameters

key

string

Returns

null | string

Implementation of

ts
Storage.getItem

key()

ts
key(index): null | string;

Defined in: storage/storage.ts:330

Reactive access to the key at the given index

Parameters

index

number

Returns

null | string

Implementation of

ts
Storage.key

peekItem()

ts
peekItem(key): null | string;

Defined in: storage/storage.ts:187

Non-reactive way to peek the current value of a key in Storage

Parameters

key

string

Returns

null | string


removeItem()

ts
removeItem(key): void;

Defined in: storage/storage.ts:293

Remove a value from Storage, triggering reactivity

Parameters

key

string

Returns

void

Implementation of

ts
Storage.removeItem

setEffect()

ts
setEffect(key, fn): void;

Defined in: storage/storage.ts:132

Parameters

key

string

fn

(value) => void

Returns

void


setItem()

ts
setItem(key, value): void;

Defined in: storage/storage.ts:234

Set a value in Storage, triggering reactivity

Parameters

key

string

value

string

Returns

void

Implementation of

ts
Storage.setItem

Properties

length

Get Signature

ts
get length(): number;

Defined in: storage/storage.ts:180

Reactive access to the number of keys in Storage

Returns

number

Implementation of

ts
Storage.length

Released under the MIT License.