UNPKG

@babylonjs/viewer

Version:

The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.

3 lines (2 loc) 2.48 kB
import{a as e,d as t}from"./KHR_interactivity-BMn2G2LI.esm.min.js";import{y as n,u as i}from"./index-OM-TXt9s.esm.min.js";import{g as s,b as o}from"./declarationMapper-sl3auZpG.esm.min.js";import"./objectModelMapping-DA3c5cv8.esm.min.js";import"./spotLight.pure-guqQj5Iw.esm.min.js";class a extends e{constructor(e){super(e),this.config=e,this.initPriority=1;for(const e in this.config.eventData){const t=this.config.eventData[e],n="string"==typeof t.type?t.type:t.type?.typeName,i="function"==typeof t.type?.serialize?t.type:s(n);t.type=i,this.registerDataOutput(e,i,t.value)}this.eventRef=this.config.eventData&&Object.prototype.hasOwnProperty.call(this.config.eventData,"event")?this.getDataOutput("event"):this.registerDataOutput("event",o)}_updateOutputs(e){this.eventRef.setValue(e.getEventReference(this.config.eventId),e)}_preparePendingTasks(e){const n=e.configuration.coordinator.getCustomEventObservable(this.config.eventId);if(n&&n.hasObservers()&&n.observers.length>t.MaxEventsPerType)return void this._reportError(e,`FlowGraphReceiveCustomEventBlock: Too many observers for event ${this.config.eventId}. Max is ${t.MaxEventsPerType}.`);const i=n.add((t,n)=>{e.configuration.coordinator._beginEventDispatch(this.config.eventId,n);try{for(const n in this.config.eventData){const i=this.getDataOutput(n);if(!i)continue;const s=t?.[n];i.setValue(void 0===s?this._getEventDataDefault(n):s,e)}this.eventRef.setValue(e.getEventReference(this.config.eventId),e),this._execute(e)}finally{e.configuration.coordinator._endEventDispatch()}});e._setExecutionVariable(this,"_eventObserver",i)}_getEventDataDefault(e){const t=this.config.eventData?.[e];return void 0!==t?.value?t.value:t?.type?.defaultValue}_cancelPendingTasks(e){const t=e.configuration.coordinator.getCustomEventObservable(this.config.eventId);if(t){const n=e._getExecutionVariable(this,"_eventObserver",null);t.remove(n)}else n.Warn(`FlowGraphReceiveCustomEventBlock: Missing observable for event ${this.config.eventId}`)}_executeEvent(e,t){return!0}serialize(e={}){super.serialize(e);const t={};for(const e in this.config.eventData)t[e]={type:this.config.eventData[e].type.typeName};e.config.eventData=t}getClassName(){return"FlowGraphReceiveCustomEventBlock"}}let r=!1;function c(){r||(r=!0,i("FlowGraphReceiveCustomEventBlock",a))}c();export{a as FlowGraphReceiveCustomEventBlock,c as RegisterFlowGraphReceiveCustomEventBlock}; //# sourceMappingURL=flowGraphReceiveCustomEventBlock-CGpodvWk.esm.min.js.map