@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.
61 lines (57 loc) • 2.37 kB
JavaScript
import { d as RichTypeNumber } from './declarationMapper-CqO08-WM.esm.js';
import { c as FlowGraphExecutionBlockWithOutSignal } from './KHR_interactivity-CEwUaqxQ.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 */
/**
* This block debounces the execution of a input, i.e. ensures that the input is only executed once every X times
*/
class FlowGraphDebounceBlock extends FlowGraphExecutionBlockWithOutSignal {
constructor(config) {
super(config);
this.count = this.registerDataInput("count", RichTypeNumber);
this.reset = this._registerSignalInput("reset");
this.currentCount = this.registerDataOutput("currentCount", RichTypeNumber);
}
_execute(context, callingSignal) {
if (callingSignal === this.reset) {
context._setExecutionVariable(this, "debounceCount", 0);
return;
}
const count = this.count.getValue(context);
const currentCount = context._getExecutionVariable(this, "debounceCount", 0);
const newCount = currentCount + 1;
this.currentCount.setValue(newCount, context);
context._setExecutionVariable(this, "debounceCount", newCount);
if (newCount >= count) {
this.out._activateSignal(context);
context._setExecutionVariable(this, "debounceCount", 0);
}
}
/**
* @returns class name of the block.
*/
getClassName() {
return "FlowGraphDebounceBlock" /* FlowGraphBlockNames.Debounce */;
}
}
let _Registered = false;
/**
* Register side effects for flowGraphDebounceBlock.
* Safe to call multiple times; only the first call has an effect.
*/
function RegisterFlowGraphDebounceBlock() {
if (_Registered) {
return;
}
_Registered = true;
RegisterClass("FlowGraphDebounceBlock" /* FlowGraphBlockNames.Debounce */, FlowGraphDebounceBlock);
}
/**
* Re-exports pure implementation and applies runtime side effects.
* Import flowGraphDebounceBlock.pure for tree-shakeable, side-effect-free usage.
*/
RegisterFlowGraphDebounceBlock();
export { FlowGraphDebounceBlock, RegisterFlowGraphDebounceBlock };
//# sourceMappingURL=flowGraphDebounceBlock-t3r9CELr.esm.js.map