@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.
59 lines (55 loc) • 2.35 kB
JavaScript
import { F as FlowGraphBlock } from './KHR_interactivity-CEwUaqxQ.esm.js';
import { b as RichTypeString, R as RichTypeAny } from './declarationMapper-CqO08-WM.esm.js';
import { u as RegisterClass } from './index-MZPybX0H.esm.js';
import './objectModelMapping-De5EKNEZ.esm.js';
import './spotLight.pure-CRdZC6Ci.esm.js';
/** This file must only contain pure code and pure imports */
/**
* A flow graph block that takes a function name, an object and an optional context as inputs and calls the function on the object.
*/
class FlowGraphFunctionReferenceBlock extends FlowGraphBlock {
constructor(
/**
* the configuration of the block
*/
config) {
super(config);
this.functionName = this.registerDataInput("functionName", RichTypeString);
this.object = this.registerDataInput("object", RichTypeAny);
this.context = this.registerDataInput("context", RichTypeAny, null);
this.output = this.registerDataOutput("output", RichTypeAny);
}
_updateOutputs(context) {
const functionName = this.functionName.getValue(context);
const object = this.object.getValue(context);
const contextValue = this.context.getValue(context);
if (object && functionName) {
const func = object[functionName];
if (func && typeof func === "function") {
this.output.setValue(func.bind(contextValue), context);
}
}
}
getClassName() {
return "FlowGraphFunctionReference" /* FlowGraphBlockNames.FunctionReference */;
}
}
let _Registered = false;
/**
* Register side effects for flowGraphFunctionReferenceBlock.
* Safe to call multiple times; only the first call has an effect.
*/
function RegisterFlowGraphFunctionReferenceBlock() {
if (_Registered) {
return;
}
_Registered = true;
RegisterClass("FlowGraphFunctionReference" /* FlowGraphBlockNames.FunctionReference */, FlowGraphFunctionReferenceBlock);
}
/**
* Re-exports pure implementation and applies runtime side effects.
* Import flowGraphFunctionReferenceBlock.pure for tree-shakeable, side-effect-free usage.
*/
RegisterFlowGraphFunctionReferenceBlock();
export { FlowGraphFunctionReferenceBlock, RegisterFlowGraphFunctionReferenceBlock };
//# sourceMappingURL=flowGraphFunctionReferenceBlock-BTegwaob.esm.js.map