import { Emitter, EventType } from "@Model/Emitter"; export type GLContext = WebGL2RenderingContext | WebGLRenderingContext; /** * 使用 GLContext 的类型 */ export abstract class GLContextObject< E extends Record = {} > extends Emitter { /** * GL 上下文 */ protected gl: GLContext = undefined as any; /** * 是否加载 */ public get isLoad(): boolean { return !!this.gl; } /** * 初始化生命周期 */ public onLoad(context: GLContext): any { this.gl = context; }; }