Library API
    Preparing search index...

    Function setStorage

    • Sets or deletes a value in the active storage mechanism across any runtime environment. Automatically serializes objects for safe storage.

      Type Parameters

      • T

      Parameters

      • key: string

        The storage key to set

      • Optionalval: T

        The value to store (if undefined, the key is deleted)

      Returns void

      setStorage('user', { name: 'Alice' });
      setStorage('user', undefined); // deletes 'user'