lingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
28 lines • 1.17 kB
JavaScript
import { forceGetInstance } from "@lincode/utils";
import { INVERSE_STANDARD_FRAME } from "../../globals";
import { isDefaultMethodArg, defaultMethodArgs } from "../../collections/typeGuards";
import Point3d from "../../math/Point3d";
export class DefaultMethodArg {
value;
allowInput;
constructor(value, allowInput = true) {
this.value = value;
this.allowInput = allowInput;
Object.freeze(this);
}
}
export const defaultMethodVoidArg = new DefaultMethodArg();
export const defaultMethodNumberArg = new DefaultMethodArg(0);
export const defaultMethodDtArg = new DefaultMethodArg(INVERSE_STANDARD_FRAME, false);
export const defaultMethodPt3dArg = Object.freeze(new Point3d(0, 0, 0));
export const isDefaultMethodArgInstance = (value) => isDefaultMethodArg(value) && "value" in value;
export default class DefaultMethod {
arg;
constructor(arg) {
this.arg = arg;
defaultMethodArgs.add(arg);
}
}
const defaultMethodMap = new Map();
export const defaultMethod = (value = defaultMethodVoidArg) => forceGetInstance(defaultMethodMap, value, DefaultMethod, [value]);
//# sourceMappingURL=DefaultMethod.js.map