Web Storage for JS
    Preparing search index...

    Class Storage

    Provides access to the Web Storage.

    Hierarchy

    • EventTarget
      • Storage

    Implements

    • Disposable
    • Iterable<[string, any], void, void>
    Index

    Properties

    changeEvent: "webstorage:change"

    The change event type.

    Accessors

    • get keys(): Set<string>

      The keys of this storage.

      Returns Set<string>

    • get length(): number

      The number of entries in this storage.

      Returns number

    Methods

    • Releases any resources associated with this object.

      Returns void

    • Returns a new iterator that allows iterating the entries of this storage.

      Returns Iterator<[string, any], void, void>

      An iterator for the entries of this storage.

    • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

      MDN Reference

      Parameters

      • type: string
      • callback: null | EventListenerOrEventListenerObject
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • Removes all entries from this storage.

      Returns void

    • Removes the value associated with the specified key.

      Type Parameters

      • T

      Parameters

      • key: string

        The storage key.

      Returns null | T

      The value associated with the key before it was removed.

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.

      MDN Reference

      Parameters

      • event: Event

      Returns boolean

    • Cancels the subscription to the global storage events.

      Returns void

    • Gets the deserialized value associated with the specified key.

      Type Parameters

      • T

      Parameters

      • key: string

        The storage key.

      Returns null | T

      The storage value, or null if the key does not exist or the value cannot be deserialized.

    • Gets a value indicating whether this storage contains the specified key.

      Parameters

      • key: string

        The storage key.

      Returns boolean

      true if this storage contains the specified key, otherwise false.

    • Registers a function that will be invoked whenever the change event is triggered.

      Parameters

      • listener: (event: StorageEvent) => void

        The event handler to register.

      Returns this

      This instance.

    • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.

      MDN Reference

      Parameters

      • type: string
      • callback: null | EventListenerOrEventListenerObject
      • Optionaloptions: boolean | EventListenerOptions

      Returns void

    • Serializes and associates a given value with the specified key.

      Parameters

      • key: string

        The storage key.

      • value: unknown

        The storage value.

      Returns this

      This instance.