DailyJS

LNUG, Supplement.js, console4worker

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

libraries events webworkers

LNUG, Supplement.js, console4worker

Posted by Alex R. Young on .
Featured

libraries events webworkers

LNUG, Supplement.js, console4worker

Posted by Alex R. Young on .

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:

  • Tom Hall - Webscaling With Node.js
  • Andy Kent - Streaming Analytics and Node.js
  • Rob Tweed - The Globals Database: It's Significance To Developers
  • Garren Smith - These are the ORMs you are looking for

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);