From 6f35d0417ac80316132ea831de8077b90f00a07d Mon Sep 17 00:00:00 2001 From: Karl Herler Date: Sun, 19 Jun 2011 23:24:12 -0700 Subject: [PATCH 1/3] Updated the readme to match documentation and work, added a few hinting comments. Closes GH-24 --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 48901ac..389f01e 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,13 @@ See the design document #### Master source var sys = require('sys'); - var Worker = require('webworker'); - - var w = new Worker('foo.js'); + var Worker = require('webworker').Worker; + + var cDir = process.cwd()+'/'; // gets the path of the executing master process + var wPath = cDir+'foo.js'; // if you have the worker in the same directory as master + //var wPath = 'foo.js'; // if you have the worker in /foo.js + + var w = new Worker(wPath); w.onmessage = function(e) { sys.debug('Received mesage: ' + sys.inspect(e)); From d068d07f95171c1cba011210898244fe732baa6c Mon Sep 17 00:00:00 2001 From: Karl Herler Date: Sun, 19 Jun 2011 23:27:38 -0700 Subject: [PATCH 2/3] Added syntax highlighting to the example code --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 389f01e..d9c31c8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ See the design document ### Example #### Master source - +```javascript var sys = require('sys'); var Worker = require('webworker').Worker; @@ -24,9 +24,10 @@ See the design document }; w.postMessage({ foo : 'bar' }); +``` #### Worker source - +```javascript onmessage = function(e) { postMessage({ test : 'this is a test' }); }; @@ -34,6 +35,7 @@ See the design document onclose = function() { sys.debug('Worker shuttting down.'); }; +``` ### API From 5aa15e3fe88a6d53b49fd1352e30684d228f273d Mon Sep 17 00:00:00 2001 From: dansdocs Date: Wed, 17 Aug 2011 23:13:02 +1000 Subject: [PATCH 3/3] Edited README.md to update the worker source example so that sys was required and available so that the termination message can be printed out. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d9c31c8..a6139cd 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ See the design document #### Worker source ```javascript + var sys = require('sys'); onmessage = function(e) { postMessage({ test : 'this is a test' }); };