Angular Signal Generators
    Preparing search index...
    • Generates a signal using sessionStorage as the store. A shared Map is used if session storage is not supported.

      Type Parameters

      • T

        The type of the value that should be stored and deserialized.

      Parameters

      • initialValue: T

        the initial value for the signal

      • key: string

        the key to use in sessionStorage

      • options: WebStorageOptions<T> = {}

        optional options to configure the signal and underlying storage.

      Returns WritableSignal<T>

      the writable signal generated from storageSignal.

      const signal1 = sessionStorageSignal(1, 'someKey');
      console.log(signal1()); // This MIGHT not be 1 depending on what was stored in sessionStorage for "someKey".
      signal1.set(100);
      console.log(signal1()); // 100 ("someKey" is now 100 in sessionStorage)