Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
8 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,12 @@ | ||
# node-worker - 0.0.1 | ||
Node Worker Pool | ||
================ | ||
|
||
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" | ||
}); | ||
}; | ||
|
||
|
||
An implementation of the web worker API with a worker pool support. | ||
|
||
Based on the [node-worker](https://github.com/cramforce/node-worker) library by | ||
Malte Ubl. | ||
|
||
Examples | ||
======== | ||
|
||
For examples, please see `test` directory. |