Generates a signal using localStorage as the store. A shared Map is used if session storage is not supported.
The type of the value that should be stored and deserialized.
the initial value for the signal
the key to use in localStorage
optional options to configure the signal and underlying storage.
the writable signal generated from storageSignal.
const signal1 = localStorageSignal(1, 'someKey');console.log(signal1()); // This MIGHT not be 1 depending on what was stored in localStorage for "someKey".signal1.set(100);console.log(signal1()); // 100 ("someKey" is now 100 in localStorage) Copy
const signal1 = localStorageSignal(1, 'someKey');console.log(signal1()); // This MIGHT not be 1 depending on what was stored in localStorage for "someKey".signal1.set(100);console.log(signal1()); // 100 ("someKey" is now 100 in localStorage)
storageSignal
Generates a signal using localStorage as the store. A shared Map is used if session storage is not supported.