@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
18 lines (17 loc) • 532 B
JavaScript
;
export class BaseNamedFunctionRegister {
constructor() {
this._functionByName = /* @__PURE__ */ new Map();
}
register(namedFunction, options) {
let printWarnings = options == null ? void 0 : options.printWarnings;
if (printWarnings == null) {
printWarnings = true;
}
const type = namedFunction.type();
if (this._functionByName.has(type) && printWarnings) {
console.warn(`namedFunction already registered`, type);
}
this._functionByName.set(type, namedFunction);
}
}