dok-timescheduler

1.0.2 • Public • Published

dok-timescheduler

Module for executing action with a delay within a game loop.

  • Schedule actions within the scheduler.
  • Run process with the current time. The action will get executed.

This is more or less the equivalent of setTimeout, but it is within the scheduler's process function, that can be run within a game loop;

const scheduler = new TimeScheduler();

schedule.scheduleAt(Date.now() + 3000, () => console.log("Action."));
// ...

//	this will display "Action." after 3 sec if schedule.process is called repeatedly. Then the action gets removed.
schedule.process(Date.now());	

Readme

Keywords

Package Sidebar

Install

npm i dok-timescheduler

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

4.23 kB

Total Files

4

Last publish

Collaborators

  • vincentlequang