Skip to content

Commit

Permalink
Mark 'subscribe()' as experimental.
Browse files Browse the repository at this point in the history
  • Loading branch information
elle-j committed May 26, 2023
1 parent 5b45b70 commit bad1d1f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Improve performance of equality queries on a non-indexed mixed property by about 30%. ([realm/realm-core#6506](https://github.com/realm/realm-core/pull/6506))
* Improve performance of rolling back write transactions after making changes. ([realm/realm-core#6513](https://github.com/realm/realm-core/pull/6513))
* Added APIs to facilitate adding and removing subscriptions. ([#5772](https://github.com/realm/realm-js/pull/5772))
* Enabled subscribing and unsubscribing directly to and from a `Results` instance via `Results.subscribe()` (asynchronous) and the experimental `Results.unsubscribe()` (synchronous).
* Experimental APIs: Enabled subscribing and unsubscribing directly to and from a `Results` instance via `Results.subscribe()` (asynchronous) and `Results.unsubscribe()` (synchronous).
* Added a `WaitForSync` enum specifying whether to wait or not wait for subscribed objects to be downloaded before returning from `Results.subscribe()`.
* Extended `SubscriptionOptions` to take a `WaitForSync` behavior and a maximum waiting timeout before returning from `Results.subscribe()`.
* Added the instance method `MutableSubscriptionSet.removeUnnamed()` for removing only unnamed subscriptions.
Expand Down
3 changes: 2 additions & 1 deletion packages/realm/src/Results.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2023 Realm Inc.
// Copyright 2022 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -120,6 +120,7 @@ export class Results<T = unknown> extends OrderedCollection<T> {
*
* @param options Options to use when adding this subscription (e.g. a name or wait behavior).
* @returns A promise that resolves to this {@link Results} instance.
* @experimental This API is experimental and may change or be removed.
*/
async subscribe(options: SubscriptionOptions = { behavior: WaitForSync.FirstTime }): Promise<this> {
const subs = this.realm.subscriptions;
Expand Down
5 changes: 2 additions & 3 deletions packages/realm/src/app-services/MutableSubscriptionSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ export type SubscriptionOptions = {
*/
behavior?: WaitForSync;
/**
* The maximum number of milliseconds to wait for objects to be downloaded.
* The maximum time (in milliseconds) to wait for objects to be downloaded.
* If the time exceeds this limit, the `Results` is returned and the download
* continues in the background. (This value affects the timeout behavior
* similar to {@link setTimeout}.)
* continues in the background.
*/
timeout?: number;
};
Expand Down

0 comments on commit bad1d1f

Please sign in to comment.