IPersistentSignalService.ts
1 import { Signal } from '@preact/signals-core'; 2 3 export const IPersistentSignalServiceSymbol = Symbol.for('IPersistentSignalService'); 4 5 /** 6 * Service that gives {@link Signal}'s which are persisted in the {@link IKeyValueStore}. 7 */ 8 export interface IPersistentSignalService { 9 /** 10 * Retrieves a {@link Signal} which will be persisted. 11 * @param storageKey the key under which to store and retrieve this value. 12 * @param defaultValue The default value to use if it has never been used. 13 */ 14 get<T>(storageKey: string, defaultValue: T): Signal<T>; 15 }