UNPKG

612 BTypeScriptView Raw
1/**
2 * inspired by Entitas' Systems
3 * @see https://github.com/sschmid/Entitas-CSharp/wiki/Systems
4 */
5export interface ISystem {
6 /**
7 * in a similar way to Unity's `Start()`, we can do some initialization works:
8 * * create global entities
9 * * init event listeners
10 */
11 initialize?(canvas: HTMLCanvasElement): void;
12 /**
13 * in a similar way to Unity's `Update()`, run once per frame
14 */
15 execute?(): Promise<void>;
16 /**
17 * run at the end of each frame
18 */
19 cleanup?(): void;
20 /**
21 * run once at the end of your program
22 */
23 tearDown?(): void;
24}