356f9ae415a38e2969d811d5c500dc8ed626ba116d4cc180e885ed01cff25437.json 6.6 KB

1
  1. {"ast":null,"code":"import { FlowGraphEventBlock } from \"../../flowGraphEventBlock.js\";\nimport { Tools } from \"../../../Misc/tools.js\";\nimport { RichTypeAny } from \"../../flowGraphRichTypes.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\n/**\n * @experimental\n * A block that receives a custom event. It saves the data sent in the eventData output.\n */\nexport class FlowGraphReceiveCustomEventBlock extends FlowGraphEventBlock {\n constructor(\n /**\n * the configuration of the block\n */\n config) {\n super(config);\n this.config = config;\n for (let i = 0; i < this.config.eventData.length; i++) {\n const dataName = this.config.eventData[i];\n this.registerDataOutput(dataName, RichTypeAny);\n }\n }\n _preparePendingTasks(context) {\n const observable = context.configuration.coordinator.getCustomEventObservable(this.config.eventId);\n this._eventObserver = observable.add(eventDatas => {\n for (let i = 0; i < eventDatas.length; i++) {\n this.dataOutputs[i].setValue(eventDatas[i], context);\n }\n this._execute(context);\n });\n }\n _cancelPendingTasks(context) {\n const observable = context.configuration.coordinator.getCustomEventObservable(this.config.eventId);\n if (observable) {\n observable.remove(this._eventObserver);\n } else {\n Tools.Warn(`FlowGraphReceiveCustomEventBlock: Missing observable for event ${this.config.eventId}`);\n }\n }\n /**\n * @returns class name of the block.\n */\n getClassName() {\n return FlowGraphReceiveCustomEventBlock.ClassName;\n }\n /**\n * Serializes this block\n * @param serializationObject the object to serialize to\n */\n serialize(serializationObject) {\n super.serialize(serializationObject);\n serializationObject.eventId = this.config.eventId;\n serializationObject.eventData = this.config.eventData;\n }\n}\n/**\n * the class name of the block.\n */\nFlowGraphReceiveCustomEventBlock.ClassName = \"FGReceiveCustomEventBlock\";\nRegisterClass(FlowGraphReceiveCustomEventBlock.ClassName, FlowGraphReceiveCustomEventBlock);","map":{"version":3,"names":["FlowGraphEventBlock","Tools","RichTypeAny","RegisterClass","FlowGraphReceiveCustomEventBlock","constructor","config","i","eventData","length","dataName","registerDataOutput","_preparePendingTasks","context","observable","configuration","coordinator","getCustomEventObservable","eventId","_eventObserver","add","eventDatas","dataOutputs","setValue","_execute","_cancelPendingTasks","remove","Warn","getClassName","ClassName","serialize","serializationObject"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js"],"sourcesContent":["import { FlowGraphEventBlock } from \"../../flowGraphEventBlock.js\";\nimport { Tools } from \"../../../Misc/tools.js\";\nimport { RichTypeAny } from \"../../flowGraphRichTypes.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\n/**\n * @experimental\n * A block that receives a custom event. It saves the data sent in the eventData output.\n */\nexport class FlowGraphReceiveCustomEventBlock extends FlowGraphEventBlock {\n constructor(\n /**\n * the configuration of the block\n */\n config) {\n super(config);\n this.config = config;\n for (let i = 0; i < this.config.eventData.length; i++) {\n const dataName = this.config.eventData[i];\n this.registerDataOutput(dataName, RichTypeAny);\n }\n }\n _preparePendingTasks(context) {\n const observable = context.configuration.coordinator.getCustomEventObservable(this.config.eventId);\n this._eventObserver = observable.add((eventDatas) => {\n for (let i = 0; i < eventDatas.length; i++) {\n this.dataOutputs[i].setValue(eventDatas[i], context);\n }\n this._execute(context);\n });\n }\n _cancelPendingTasks(context) {\n const observable = context.configuration.coordinator.getCustomEventObservable(this.config.eventId);\n if (observable) {\n observable.remove(this._eventObserver);\n }\n else {\n Tools.Warn(`FlowGraphReceiveCustomEventBlock: Missing observable for event ${this.config.eventId}`);\n }\n }\n /**\n * @returns class name of the block.\n */\n getClassName() {\n return FlowGraphReceiveCustomEventBlock.ClassName;\n }\n /**\n * Serializes this block\n * @param serializationObject the object to serialize to\n */\n serialize(serializationObject) {\n super.serialize(serializationObject);\n serializationObject.eventId = this.config.eventId;\n serializationObject.eventData = this.config.eventData;\n }\n}\n/**\n * the class name of the block.\n */\nFlowGraphReceiveCustomEventBlock.ClassName = \"FGReceiveCustomEventBlock\";\nRegisterClass(FlowGraphReceiveCust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C,wBAAwB,CAAC,IAAI,CAACX,MAAM,CAACY,OAAO,CAAC;IAClG,IAAIJ,UAAU,EAAE;MACZA,UAAU,CAACY,MAAM,CAAC,IAAI,CAACP,cAAc,CAAC;IAC1C,CAAC,MACI;MACDlB,KAAK,CAAC0B,IAAI,CAAC,kEAAkE,IAAI,CAACrB,MAAM,CAACY,OAAO,EAAE,CAAC;IACvG;EACJ;EACA;AACJ;AACA;EACIU,YAAYA,CAAA,EAAG;IACX,OAAOxB,gCAAgC,CAACyB,SAAS;EACrD;EACA;AACJ;AACA;AACA;EACIC,SAASA,CAACC,mBAAmB,EAAE;IAC3B,KAAK,CAACD,SAAS,CAACC,mBAAmB,CAAC;IACpCA,mBAAmB,CAACb,OAAO,GAAG,IAAI,CAACZ,MAAM,CAACY,OAAO;IACjDa,mBAAmB,CAACvB,SAAS,GAAG,IAAI,CAACF,MAAM,CAACE,SAAS;EACzD;AACJ;AACA;AACA;AACA;AACAJ,gCAAgC,CAACyB,SAAS,GAAG,2BAA2B;AACxE1B,aAAa,CAACC,gCAAgC,CAACyB,SAAS,EAAEzB,gCAAgC,CAAC","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}