These objects are returned when calling collections() on Store.

They allow chaining of further collections-related functions. You can either call exec() on the object to get an array of Collections as an immediate return value, or you can establish either a live query or a subscription, which both work over time.

A live query, established by calling observeLocal(), will notify you every time there's a change in the collections that the device knows about.

A subscription, established by calling subscribe(), will act as a signal to other peers that the device connects to that you would like to receive updates from them about the collections that they know about.

Hierarchy

  • PendingCollectionsOperation

Implements

Methods

  • Return the list of collections requested based on the preceding function chaining.

    Returns

    A list of Collections based on the preceding function chaining.

    Returns Promise<Collection[]>

  • Enables you to listen for changes that occur in relation to the collections that are known about locally.

    The returned LiveQuery object must be kept in scope for as long as you want the provided handler to be called when an update occurs.

    This won't subscribe to receive updates from other devices and so it will only fire when a local change to the known about collections occurs. If you want to receive remote updates as well, then create a subscription via subscribe().

    Returns

    A LiveQuery object that must be kept in scope for as long as you want to keep receiving updates.

    Parameters

    Returns LiveQuery

  • Enables you to listen for changes that occur in relation to the collections that are known about locally.

    The returned LiveQuery object must be kept in scope for as long as you want the provided handler to be called when an update occurs.

    This won't subscribe to receive updates from other devices and so it will only fire when a local change to the known about collections occurs. If you want to receive remote updates as well, then create a subscription via subscribe().

    Returns

    A LiveQuery object that must be kept in scope for as long as you want to keep receiving updates.

    Parameters

    Returns LiveQuery

  • Offset the resulting set of collections.

    This is useful if you aren't interested in the first N collections for one reason or another. For example, you might already have obtained the first 20 collections and so you might want to get the next 20 collections, and that is when you would use offset().

    Returns

    A PendingCollectionsOperation that you can chain further function calls to.

    Parameters

    • offset: number

      The number of collections that you want the eventual resulting set of collections to be offset by (and thus not include).

    Returns PendingCollectionsOperation

  • Subscribes the device to updates about collections that other devices know about.

    The returned Subscription object must be kept in scope for as long as you want to keep receiving updates.

    Returns

    A Subscription object that must be kept in scope for as long as you want to keep receiving updates from other devices about the collections that they know about.

    Returns Subscription