Example #1
0
for (i = 0; i < n; i += 1) {
    emitter.emit("go", 1);
}

log(time, c, "event-when");
console.log(process.memoryUsage());

emitter = new EvW();

emitter.loopMax = 2*n;

emitter.scope('c', {a:0});

emitter.action('add', function count (num, scope, context) {
    context.a += num;
});

emitter.on("go", "add:c");

time = process.hrtime();

for (i = 0; i < n; i += 1) {
    emitter.emit("go", 1);
}

log(time, emitter.scope('c').a, "event-when scope");
console.log(process.memoryUsage());

emitter = new EvW();