Timer class for Node.js

I’m not a fan of the setInterval idea in JavaScript. I’ve seen timers implemented in a much better way in a certain ECMAScript based language that shall remain nameless.

That’s why I’ve created a Timer class for Node.js that uses EventEmitter and allows you to think of timers in an Object-Oriented way.

Here’s a simple example:

//Creates a timer that runs 10 times, once every 100ms.
var timer = new Timer(100, 10);
timer.on('timer', function(ev)
    console.log('Timer fired ' + timer.currentCount);

You can also stop the timer using timer.stop(), stop and reset the current count using timer.reset() and change the delay with timer.delay = 1000.


Now read this

How SWFWire works

This is an overview of a decompiler and a debugger I made in Flash a few years ago. This is mainly for my own reference. There are three parts of SWFWire: SWFWire Decompiler - A library for SWF and ABC decompilation SWFWire Inspector -... Continue →