1 |
- {"ast":null,"code":"import { FlowGraphBlock } from \"../../flowGraphBlock.js\";\nconst cacheName = \"cachedOperationValue\";\nconst cacheExecIdName = \"cachedExecutionId\";\n/**\n * @experimental\n */\nexport class FlowGraphCachedOperationBlock extends FlowGraphBlock {\n constructor(outputRichType, config) {\n super(config);\n this.value = this.registerDataOutput(\"value\", outputRichType);\n }\n _updateOutputs(context) {\n const cachedExecutionId = context._getExecutionVariable(this, cacheExecIdName);\n const cachedValue = context._getExecutionVariable(this, cacheName);\n if (cachedValue !== undefined && cachedExecutionId === context.executionId) {\n this.value.setValue(cachedValue, context);\n } else {\n const calculatedValue = this._doOperation(context);\n context._setExecutionVariable(this, cacheName, calculatedValue);\n context._setExecutionVariable(this, cacheExecIdName, context.executionId);\n this.value.setValue(calculatedValue, context);\n }\n }\n}","map":{"version":3,"names":["FlowGraphBlock","cacheName","cacheExecIdName","FlowGraphCachedOperationBlock","constructor","outputRichType","config","value","registerDataOutput","_updateOutputs","context","cachedExecutionId","_getExecutionVariable","cachedValue","undefined","executionId","setValue","calculatedValue","_doOperation","_setExecutionVariable"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js"],"sourcesContent":["import { FlowGraphBlock } from \"../../flowGraphBlock.js\";\nconst cacheName = \"cachedOperationValue\";\nconst cacheExecIdName = \"cachedExecutionId\";\n/**\n * @experimental\n */\nexport class FlowGraphCachedOperationBlock extends FlowGraphBlock {\n constructor(outputRichType, config) {\n super(config);\n this.value = this.registerDataOutput(\"value\", outputRichType);\n }\n _updateOutputs(context) {\n const cachedExecutionId = context._getExecutionVariable(this, cacheExecIdName);\n const cachedValue = context._getExecutionVariable(this, cacheName);\n if (cachedValue !== undefined && cachedExecutionId === context.executionId) {\n this.value.setValue(cachedValue, context);\n }\n else {\n const calculatedValue = this._doOperation(context);\n context._setExecutionVariable(this, cacheName, calculatedValue);\n context._setExecutionVariable(this, cacheExecIdName, context.executionId);\n this.value.setValue(calculatedValue, context);\n }\n }\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,yBAAyB;AACxD,MAAMC,SAAS,GAAG,sBAAsB;AACxC,MAAMC,eAAe,GAAG,mBAAmB;AAC3C;AACA;AACA;AACA,OAAO,MAAMC,6BAA6B,SAASH,cAAc,CAAC;EAC9DI,WAAWA,CAACC,cAAc,EAAEC,MAAM,EAAE;IAChC,KAAK,CAACA,MAAM,CAAC;IACb,IAAI,CAACC,KAAK,GAAG,IAAI,CAACC,kBAAkB,CAAC,OAAO,EAAEH,cAAc,CAAC;EACjE;EACAI,cAAcA,CAACC,OAAO,EAAE;IACpB,MAAMC,iBAAiB,GAAGD,OAAO,CAACE,qBAAqB,CAAC,IAAI,EAAEV,eAAe,CAAC;IAC9E,MAAMW,WAAW,GAAGH,OAAO,CAACE,qBAAqB,CAAC,IAAI,EAAEX,SAAS,CAAC;IAClE,IAAIY,WAAW,KAAKC,SAAS,IAAIH,iBAAiB,KAAKD,OAAO,CAACK,WAAW,EAAE;MACxE,IAAI,CAACR,KAAK,CAACS,QAAQ,CAACH,WAAW,EAAEH,OAAO,CAAC;IAC7C,CAAC,MACI;MACD,MAAMO,eAAe,GAAG,IAAI,CAACC,YAAY,CAACR,OAAO,CAAC;MAClDA,OAAO,CAACS,qBAAqB,CAAC,IAAI,EAAElB,SAAS,EAAEgB,eAAe,CAAC;MAC/DP,OAAO,CAACS,qBAAqB,CAAC,IAAI,EAAEjB,eAAe,EAAEQ,OAAO,CAACK,WAAW,CAAC;MACzE,IAAI,CAACR,KAAK,CAACS,QAAQ,CAACC,eAAe,EAAEP,OAAO,CAAC;IACjD;EACJ;AACJ","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}
|