Usage of the SDK constitutes your agreement with the Matterport SDK Agreement. Email developers@matterport.com with any questions.
Type parameters
-
DataT
The type of the data being observed.
Hierarchy
- IObservable
Index
Methods
subscribe
-
Subscribe to changes on this object. When this observable detects a change, the
observer
provided will be called with the data associated with this observable.// Example: subscribe to changes in the app state sdk.App.state.subscribe((appState) => { console.log(`App state changed to: ${appState.phase}`); });
or:
sdk.App.state.subscribe({ onChanged(appState) { console.log(`App state changed to: ${appState.phase}`); } });
Parameters
-
observer: IObserver<DataT> | ObserverCallback<DataT>
Returns ISubscription
A subscription that can be used to remove the subscribed observer.
-
waitUntil
-
Wait for a specific condition on this object to be met. When this observable detects a change, the
condition
provided will be called. When thecondition
returns true, the returned Promise will be resolved.// Example: pause execution of code until the app state is in the "playing" phase await sdk.App.state.waitUntil( appState => appState.phase == sdk.App.Phase.PLAYING );
or:
await sdk.App.state.waitUntil({ waitUntil(appState) { return appState.phase == sdk.App.Phase.PLAYING; } });
Parameters
-
condition: ICondition<DataT> | ConditionCallback<DataT>
Returns Promise<DataT>
A promise that is resolved when
condition
returns true. -
A data object that can have its changes observed via subscribing an IObserver or ObserverCallback or waited on for a specific condition to be met.