UNPKG

mylingo3d

Version:

Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor

35 lines (31 loc) 964 B
import Appendable from "../api/core/Appendable" import ISetup, { setupDefaults, setupSchema } from "../interface/ISetup" import { pullSetupStack, pushSetupStack, refreshSetupStack } from "../states/useSetupStack" class Setup extends Appendable { public static componentName = "setup" public static defaults = setupDefaults public static schema = setupSchema protected data: Partial<ISetup> = {} public constructor(protected noEffect?: boolean) { super() if (noEffect) return pushSetupStack(this.data) this.then(() => pullSetupStack(this.data)) } } for (const key of Object.keys(setupSchema)) Object.defineProperty(Setup.prototype, key, { get() { return this.data[key] }, set(value) { this.data[key] = value !this.noEffect && refreshSetupStack() } }) interface Setup extends Appendable, ISetup {} export default Setup