DailyJS

LNUG, Supplement.js, console4worker

2011-09-16 00:00:00 +0100 by Alex R. Young

LNUG

The London Node.js User Group occurs on the last
Wednesday of every month, in Camden. This month's event is on the 28th
of September at 6pm, and has four talks scheduled:

There's a Google Group for keeping up to date with the group: LNUG
Google Group
.

Supplement.js

Supplement.js (GitHub: olivernn / supplement.js) by Oliver
Nightingale adds extensions to built-in types:

[Supplement.js is] a small collection of utility functions to make working with JavaScript that much sweeter and more expressive. Responsibly adds extensions to built in types.

There are some nice functional style methods, like
Array.prototype.head, Array.prototype.tail,
Array.prototype.take, and a lot of functions you probably
use from Underscore.js.

The Function extensions are interesting too:
Function.prototype.throttle for example returns a function
that will only execute once every n milliseconds.

console4Worker

console4Worker (GitHub: jeromeetienne / console4Worker,
License: MIT) by Jerome Etienne helps debug WebWorkers by making
console.log (and other console methods) work
inside workers in browsers that don't yet support this.

Some configuration within each worker is required first:

importScripts('console4Worker-worker.js');
console.log("console call made from inside a webworker");

Then on the actual page:

// init the worker
var worker  = new Worker("worker.js");
// bind the console4Worker to get console API from worker
console4Worker.bind(worker);

worker.addEventListener('message', function(event) {
  // filter this event if it is from console4Worker
  if (console4Worker.filterEvent(event)) {
    return;
  }

  // ... here handle your own events
}, false);