How to use the babylonjs.Observable function in babylonjs

To help you get started, we’ve selected a few babylonjs examples, based on popular ways it is used in public projects.

github BabylonJS / Babylon.js / Viewer / src / templateManager.ts View on Github external
constructor(public name: string, private configuration: TemplateConfiguration) {
        this.onInit = new Observable<Template>();
        this.onLoaded = new Observable<Template>();
        this.onAppended = new Observable<Template>();
        this.onStateChange = new Observable<Template>();

        this.isLoaded = false;
        /*
                if (configuration.id) {
                    this.parent.id = configuration.id;
                }
        */
        this.onInit.notifyObservers(this);

        let htmlContentPromise = getTemplateAsHtml(configuration);

        htmlContentPromise.then(htmlTemplate => {
            if (htmlTemplate) {
                let compiledTemplate = Handlebars.compile(htmlTemplate);
github BabylonJS / Babylon.js / Viewer / src / managers / observablesManager.ts View on Github external
constructor() {
        this.onSceneInitObservable = new Observable();
        this.onEngineInitObservable = new Observable();
        this.onModelLoadedObservable = new Observable();
        this.onModelLoadProgressObservable = new Observable();
        this.onModelLoadErrorObservable = new Observable();
        this.onModelAddedObservable = new Observable();
        this.onModelRemovedObservable = new Observable();
        this.onViewerInitDoneObservable = new Observable();
        this.onViewerInitStartedObservable = new Observable();
        this.onLoaderInitObservable = new Observable();
        this.onFrameRenderedObservable = new Observable();
        this.onEnteringVRObservable = new Observable();
        this.onExitingVRObservable = new Observable();
    }
github BabylonJS / Babylon.js / Viewer / src / templateManager.ts View on Github external
constructor(public containerElement: HTMLElement) {
        this.templates = {};

        this.onInit = new Observable<Template>();
        this.onLoaded = new Observable<Template>();
        this.onStateChange = new Observable<Template>();
        this.onAllLoaded = new Observable<TemplateManager>();
    }
github BabylonJS / Babylon.js / Viewer / src / managers / observablesManager.ts View on Github external
constructor() {
        this.onSceneInitObservable = new Observable();
        this.onEngineInitObservable = new Observable();
        this.onModelLoadedObservable = new Observable();
        this.onModelLoadProgressObservable = new Observable();
        this.onModelLoadErrorObservable = new Observable();
        this.onModelAddedObservable = new Observable();
        this.onModelRemovedObservable = new Observable();
        this.onViewerInitDoneObservable = new Observable();
        this.onViewerInitStartedObservable = new Observable();
        this.onLoaderInitObservable = new Observable();
        this.onFrameRenderedObservable = new Observable();
        this.onEnteringVRObservable = new Observable();
        this.onExitingVRObservable = new Observable();
    }
github BabylonJS / Babylon.js / Viewer / src / managers / observablesManager.ts View on Github external
constructor() {
        this.onSceneInitObservable = new Observable();
        this.onEngineInitObservable = new Observable();
        this.onModelLoadedObservable = new Observable();
        this.onModelLoadProgressObservable = new Observable();
        this.onModelLoadErrorObservable = new Observable();
        this.onModelAddedObservable = new Observable();
        this.onModelRemovedObservable = new Observable();
        this.onViewerInitDoneObservable = new Observable();
        this.onViewerInitStartedObservable = new Observable();
        this.onLoaderInitObservable = new Observable();
        this.onFrameRenderedObservable = new Observable();
        this.onEnteringVRObservable = new Observable();
        this.onExitingVRObservable = new Observable();
    }
github BabylonJS / Babylon.js / Viewer / src / templateManager.ts View on Github external
constructor(public name: string, private configuration: TemplateConfiguration) {
        this.onInit = new Observable<Template>();
        this.onLoaded = new Observable<Template>();
        this.onAppended = new Observable<Template>();
        this.onStateChange = new Observable<Template>();

        this.isLoaded = false;
        /*
                if (configuration.id) {
                    this.parent.id = configuration.id;
                }
        */
        this.onInit.notifyObservers(this);

        let htmlContentPromise = getTemplateAsHtml(configuration);

        htmlContentPromise.then(htmlTemplate => {
            if (htmlTemplate) {
                let compiledTemplate = Handlebars.compile(htmlTemplate);
                let config = this.configuration.config || {};
                let rawHtml = compiledTemplate(config);
github BabylonJS / Babylon.js / Viewer / src / managers / observablesManager.ts View on Github external
constructor() {
        this.onSceneInitObservable = new Observable();
        this.onEngineInitObservable = new Observable();
        this.onModelLoadedObservable = new Observable();
        this.onModelLoadProgressObservable = new Observable();
        this.onModelLoadErrorObservable = new Observable();
        this.onModelAddedObservable = new Observable();
        this.onModelRemovedObservable = new Observable();
        this.onViewerInitDoneObservable = new Observable();
        this.onViewerInitStartedObservable = new Observable();
        this.onLoaderInitObservable = new Observable();
        this.onFrameRenderedObservable = new Observable();
        this.onEnteringVRObservable = new Observable();
        this.onExitingVRObservable = new Observable();
    }
github BabylonJS / Babylon.js / Viewer / src / model / viewerModel.ts View on Github external
constructor(private _modelConfiguration: IModelConfiguration, private _scene: Scene, disableAutoLoad = false) {
        this.onLoadedObservable = new Observable();
        this.onLoadErrorObservable = new Observable();
        this.onLoadProgressObservable = new Observable();

        this._animations = [];

        if (!disableAutoLoad) {
            this._initLoad();
        }
    }
github BabylonJS / Babylon.js / Viewer / src / model / viewerModel.ts View on Github external
constructor(private _modelConfiguration: IModelConfiguration, private _scene: Scene, disableAutoLoad = false) {
        this.onLoadedObservable = new Observable();
        this.onLoadErrorObservable = new Observable();
        this.onLoadProgressObservable = new Observable();

        this._animations = [];

        if (!disableAutoLoad) {
            this._initLoad();
        }
    }
github BabylonJS / Babylon.js / Viewer / src / managers / observablesManager.ts View on Github external
constructor() {
        this.onSceneInitObservable = new Observable();
        this.onEngineInitObservable = new Observable();
        this.onModelLoadedObservable = new Observable();
        this.onModelLoadProgressObservable = new Observable();
        this.onModelLoadErrorObservable = new Observable();
        this.onModelAddedObservable = new Observable();
        this.onModelRemovedObservable = new Observable();
        this.onViewerInitDoneObservable = new Observable();
        this.onViewerInitStartedObservable = new Observable();
        this.onLoaderInitObservable = new Observable();
        this.onFrameRenderedObservable = new Observable();
        this.onEnteringVRObservable = new Observable();
        this.onExitingVRObservable = new Observable();
    }