本文整理匯總了TypeScript中babylonjs/Misc/observable.Observable類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Observable類的具體用法?TypeScript Observable怎麽用?TypeScript Observable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Observable類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: dispose
/**
* dispose the manager and all of its associated viewers
*/
public dispose() {
delete this._onViewerAdded;
for (let id in this._viewers) {
this._viewers[id].dispose();
}
this.onViewerAddedObservable.clear();
this.onViewerRemovedObservable.clear();
}
示例2: Promise
return new Promise((resolve, reject) => {
let localViewer = this.getViewerById(id);
if (localViewer) {
return resolve(localViewer);
}
let viewerFunction = (viewer: AbstractViewer) => {
if (viewer.getBaseId() === id) {
resolve(viewer);
this.onViewerAddedObservable.removeCallback(viewerFunction);
}
};
this.onViewerAddedObservable.add(viewerFunction);
});
示例3: dispose
dispose() {
this.onSceneInitObservable.clear();
this.onEngineInitObservable.clear();
this.onModelLoadedObservable.clear();
this.onModelLoadProgressObservable.clear();
this.onModelLoadErrorObservable.clear();
this.onModelAddedObservable.clear();
this.onModelRemovedObservable.clear();
this.onViewerInitDoneObservable.clear();
this.onLoaderInitObservable.clear();
this.onFrameRenderedObservable.clear();
this.onEnteringVRObservable.clear();
this.onExitingVRObservable.clear();
}
示例4: _onViewerAdded
private _onViewerAdded(viewer: AbstractViewer) {
this.onViewerAdded && this.onViewerAdded(viewer);
this.onViewerAddedObservable.notifyObservers(viewer);
}
示例5: resolve
let viewerFunction = (viewer: AbstractViewer) => {
if (viewer.getBaseId() === id) {
resolve(viewer);
this.onViewerAddedObservable.removeCallback(viewerFunction);
}
};
示例6: removeViewer
/**
* remove a viewer from the viewer manager
* @param viewer the viewer to remove
*/
public removeViewer(viewer: AbstractViewer) {
let id = viewer.getBaseId();
delete this._viewers[id];
this.onViewerRemovedObservable.notifyObservers(id);
}