Members
If state
is Realm.App.Sync.SubscriptionsState.Error
, this will return a string
representing why the SubscriptionSet is in an error state. null
is returned if there is no error.
Type:
string
or null
Returns true
if there are no subscriptions in the set, false
otherwise.
Type:
boolean
The number of subscriptions in the set.
Type:
number
The state of the SubscriptionSet.
Type:
Realm.App.Sync.SubscriptionSetState
The version of the SubscriptionSet. This is incremented every time a
Realm.App.Sync.SubscriptionSet#update
is applied.
Type:
number
Methods
- query
- Type:
Realm.Results
A
Realm.Results
instance representing the query to subscribe to.- options
- Type:
Realm.App.Sync.SubscriptionOptions
An optional
Realm.App.Sync.SubscriptionOptions
object containing options to use when adding this subscription (e.g. to give the subscription a name).- query
- Type:
Realm.Results
A
Realm.Results
instance representing the query to remove a subscription to.- name
- Type:
string
The name of the subscription to remove.
- objectType
- Type:
string
The string name of the object type to remove all subscriptions for.
- subscription
- Type:
Realm.App.Sync.Subscription
The
Realm.App.Sync.Subscription
instance to remove.
Realm.App.Sync.Subscription
Adds 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 Realm.Results
instance returned from Realm#objects
,
for example: mutableSubs.add(realm.objects("Cat").filtered("age > 10"));
.
Parameters:
Realm.App.Sync.Subscription
The new subscription.
boolean
Removes a subscription with the given query from the SubscriptionSet.
Parameters:
boolean
true
if the subscription was removed, false
if it was not found.
number
Removes all subscriptions from the SubscriptionSet.
Returns:number
The number of subscriptions removed.
boolean
Removes a subscription with the given name from the SubscriptionSet.
Parameters:
boolean
true
if the subscription was removed, false
if it was not found.
number
Removes all subscriptions for the specified object type from the SubscriptionSet.
Parameters:
number
The number of subscriptions removed.
boolean
Removes the specified subscription from the SubscriptionSet.
Parameters:
boolean
true
if the subscription was removed, false
if it was not found.
Inherited Methods
- callback
- Type:
function
Function to execute on each object in the SubscriptionSet. If this function returns
true
for every object, then this method will returntrue
. This function takes three arguments:object
– The current object being processed in the SubscriptionSet.index
– The index of the object being processed in the SubscriptionSet.subscriptionSet
– The SubscriptionSet itself.
- thisArg optional
- Type:
object
The value of
this
whencallback
is called.- name
- Type:
string
The name to search for.
- query
- Type:
Realm.Results
The query to search for, represented as a
Realm.Results
instance, e.g.Realm.objects("Cat").filtered("age > 10")
.- callback
- Type:
function
Function to execute on each object in the SubscriptionSet. This function takes three arguments:
object
– The current object being processed in the SubscriptionSet.index
– The index of the object being processed in the SubscriptionSet.subscriptionSet
– The SubscriptionSet itself.
- thisArg optional
- Type:
object
The value of
this
whencallback
is called.- callback
- Type:
function
Function to execute on each object in the SubscriptionSet. This function takes three arguments:
object
– The current object being processed in the SubscriptionSet.index
– The index of the object being processed in the SubscriptionSet.subscriptionSet
– The SubscriptionSet itself.
- thisArg optional
- Type:
object
The value of
this
whencallback
is called.- callback
- Type:
function
Function to execute on each object in the SubscriptionSet. This function takes four arguments:
previousValue
– The value previously returned in the last invocation of the callback, orinitialValue
, if supplied.object
– The current object being processed in the SubscriptionSet.index
– The index of the object being processed in the SubscriptionSet.subscriptionSet
– The SubscriptionSet itself.
- initialValue optional
- Type:
object
The value to use as the first argument to the first call of the
callback
.-
TypeError
If the SubscriptionSet is empty and no
initialValue
was supplied.
- If SubscriptionSet consists of a single object, and no
initalValue
was supplied, then that object will be returned. - If the SubscriptionSet is empty, then
initialValue
must be supplied and will be returned. - callback
- Type:
function
Function to execute on each object, from right to left, in the SubscriptionSet. This function takes four arguments:
previousValue
– The value previously returned in the last invocation of the callback, orinitialValue
, if supplied.object
– The current object being processed in the SubscriptionSet.index
– The index of the object being processed in the SubscriptionSet.subscriptionSet
– The SubscriptionSet itself.
- initialValue optional
- Type:
object
The value to use as the first argument to the first call of the
callback
.-
TypeError
If the SubscriptionSet is empty and no
initialValue
was supplied.
- If SubscriptionSet consists of a single object, and no
initalValue
was supplied, then that object will be returned. - If the SubscriptionSet is empty, then
initialValue
must be supplied and will be returned. - callback
- Type:
function
Function to execute on each object in the SubscriptionSet. If this function ever returns
true
, then this method will returntrue
. This function takes three arguments:object
– The current object being processed in the SubscriptionSet.index
– The index of the object being processed in the SubscriptionSet.subscriptionSet
– The SubscriptionSet itself.
- thisArg optional
- Type:
object
The value of
this
whencallback
is called.
boolean
Parameters:
boolean
representing if callback
returned true
for every object in the
SubscriptionSet.
Realm.App.Sync.Subscription
or null
Find a subscription by name.
Parameters:
Realm.App.Sync.Subscription
or null
The named subscription, or null
if the subscription is not found.
Realm.App.Sync.Subscription
or null
Find a subscription by query. Will match both named and unnamed subscriptions.
Parameters:
Realm.App.Sync.Subscription
or null
The subscription with the specified query,
or null
if the subscription is not found.
Parameters:
[any, ...]
Parameters:
[any, ...]
– the return values of callback
after being called on every object
in the SubscriptionSet.
any
Parameters:
Throws:
any
– the value returned by the final invocation of callback
, except for
the following special cases:
any
Parameters:
Throws:
any
– the value returned by the final invocation of callback
, except for
the following special cases:
boolean
Parameters:
boolean
– true
when callback
returns true
for an object in the SubscriptionSet,
otherwise false
.