• Stars
    star
    168
  • Rank 225,507 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 14 years ago
  • Updated over 14 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An implementation of the WebWorker API for node.js

node-worker - 0.0.1

node-worker is an implementation of the WebWorker API for node.js. http://www.whatwg.org/specs/web-workers/current-work/

Example

var Worker = require("../lib/worker").Worker;

var worker = new Worker("worker.js");

worker.postMessage({
  hello: "world"
});

worker.onmessage = function (msg) {
  sys.puts(msg.hello);
};

worker.addListener("message", function (msg) {
  sys.puts(msg.hello);
  worker.terminate();
});

Example Worker File

var worker = require("worker").worker;

worker.onmessage = function (msg) {
  worker.postMessage({
    hello: "mother"
  });
};