Class StoreObserver<T, S>

A store observer invokes a given handler whenever results for its query change.

The store observer will remain active until it is cancelled, or the Ditto instance managing the observer has been closed.

Create a store observer by calling ditto.store.registerObserver().

Type Parameters

  • T = any

    The type of items in query results. This is a convenience type that is neither inferred from the store observer's query nor validated against it.

  • S extends DQLQueryArguments = DQLQueryArguments

    The type of query arguments.

Properties

ditto: Ditto

The Ditto instance this store observer is registered with.

queryArguments?: Readonly<S>

The query arguments of the store observer (as passed when registering it).

queryString: string

The query string of the store observer (as passed when registering it).

Accessors

  • get isCancelled(): boolean
  • Convenience property, returns true once the store observer has been cancelled.

    Returns boolean

Methods

  • Cancels the store observer and unregisters it. No-op if the store observer has already been cancelled.

    Returns void