Releases: soimy/eventemitter3-timer
Releases · soimy/eventemitter3-timer
Version 1.0.1
Installation
npm install eventemitter3-timer
Usage
Browserify - Webpack
If you use Browserify or Webpack you can use timer like this:
import { Timer, TimerManager } from "eventemitter3-timer";
//create PIXI application
const app = new PIXI.Application(800,600);
document.body.appendChild(app.view);
//create timer
const timer = new Timer(1000); // in ms
timer.on("end", () => {
console.log("Timer ended.");
});
timer.start();
//increment timer in ticker loop
app.ticker.add(() => Timer.timemanager.update(app.ticker.elapsedMS), this);
Prebuilt files
Prebuilt minified js expose a EE3Timer
namespace.
//create PIXI application
const app = new PIXI.Application(800,600);
document.body.appendChild(app.view);
const timer = new EE3Timer.Timer(1000); // in ms
timer.on("end", () => {
console.log("Timer ended.");
});
timer.start();
//increment timer in ticker loop
app.ticker.add(() => Timer.timemanager.update(app.ticker.elapsedMS), this);