Skip to content

Scheduler beta ​

Class of @v12-engine/engine

ts
export declare class Scheduler

Runs the systems of a world in their order, each as often as it asks. The order is worked out whenever a system is added or taken out: by phase first, then by what each says it comes before or after, then in the order they were added. Measures each one while profiling is on, for the stats panel.

Members ​

constructor ​

ts
constructor(systems: System[]);

Constructs a new instance of the Scheduler class

add ​

ts
add(system: System): void;

Adds a system to a world that is already running, like a computer player

disable ​

ts
disable(name: string): void;

Switches a system off: it no longer runs, and stays off when others are added

profiling ​

ts
profiling: boolean;

Whether to time each system. Costs two clock readings per system per tick, so it is off unless someone looks

remove ​

ts
remove(name: string): boolean;

Takes a system out by name. False when there is none of that name

run ​

ts
run(world: World): void;

Runs one tick of every system that is due. Each is given the time since it last ran

systems ​

ts
get systems(): readonly System[];

The systems, in the order they run

timing ​

ts
timing(): SystemTiming[];

What each system takes, in the order they run. Empty until profiling has been on for a while