The mutable version of a given SubscriptionSet. The MutableSubscriptionSet instance can only be used from inside the SubscriptionSet.update callback.

Hierarchy (view full)

Constructors

Accessors

  • get error(): null | string
  • If state is SubscriptionSetState.Error, this will be a string representing why the SubscriptionSet is in an error state. It will be null if there is no error.

    Returns null | string

    A string representing the error, or null if there is no error.

  • get isEmpty(): boolean
  • Whether there are no subscriptions in the set.

    Returns boolean

    true if there are no subscriptions in the set, false otherwise.

  • get length(): number
  • Returns number

    The number of subscriptions in the set.

  • get state(): SubscriptionSetState
  • Returns SubscriptionSetState

    The state of the SubscriptionSet.

  • get version(): number
  • The version of the SubscriptionSet. This is incremented every time a SubscriptionSet.update is applied.

    Returns number

    The version of the SubscriptionSet.

Methods

  • Makes the subscription set iterable.

    Returns IterableIterator<Subscription>

    Iterable of each value in the set.

    Example

    for (const subscription of subscriptions) {
    // ...
    }
  • Add a query to the set of active subscriptions. The query will be joined via an OR operator with any existing queries for the same type.

    A query is represented by a Results instance returned from Realm.objects, for example: mutableSubs.add(realm.objects("Cat").filtered("age > 10"));.

    Parameters

    Returns Subscription

    A Subscription instance for the new subscription.

  • Find a subscription by name.

    Parameters

    • name: string

      The name to search for.

    Returns null | Subscription

    The named subscription, or null if the subscription is not found.

  • Find a subscription by query. Will match both named and unnamed subscriptions.

    Type Parameters

    • Subscription

    Parameters

    Returns null | Subscription

    The subscription with the specified query, or null if the subscription is not found.

  • Remove a subscription with the given query from the SubscriptionSet.

    Parameters

    • query: AnyResults

      A Results instance representing the query to remove a subscription to.

    Returns boolean

    true if the subscription was removed, false if it was not found.

  • Remove all subscriptions from the SubscriptionSet.

    Returns number

    The number of subscriptions removed.

  • Remove a subscription with the given name from the SubscriptionSet.

    Parameters

    • name: string

      The name of the subscription to remove.

    Returns boolean

    true if the subscription was removed, false if it was not found.

  • Remove all subscriptions for the specified object type from the SubscriptionSet.

    Parameters

    • objectType: string

      The string name of the object type to remove all subscriptions for.

    Returns number

    The number of subscriptions removed.

  • Remove the specified subscription from the SubscriptionSet.

    Parameters

    Returns boolean

    true if the subscription was removed, false if it was not found.

  • Remove all unnamed/anonymous subscriptions from the SubscriptionSet.

    Returns number

    The number of subscriptions removed.

Generated using TypeDoc