Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Create npm pkg; refactor to support packaging.

  • Loading branch information...
commit eafc37b641512c8d48561b37c983a0b669e22251 1 parent 525c148
@pgriess authored
View
2  Makefile
@@ -6,7 +6,7 @@ INSTALL_DIR ?= /opt/local/share/node
test:
for f in `ls ./test/test-*.js` ; do \
- NODE_PATH=./lib:$(NODE_PATH) node $$f ; \
+ node $$f ; \
done
install:
View
25 README.md
@@ -7,7 +7,7 @@ API](http://www.whatwg.org/specs/web-workers/current-work/) for
#### Master source
var sys = require('sys');
- var Worker = require('webworker').Worker;
+ var Worker = require('webworker/webworker').Worker;
var w = new Worker('foo.js');
@@ -55,20 +55,13 @@ In addition, some nonstandard APIs are provided
### Installation
-This package requires [node-msgpack](http://github.com/pgriess/node-msgpack).
+This package can be installed via (npm)[http://npmjs.org/] as follows
-Installation is done using `make` on the `install` target. The `INSTALL_DIR`
-variable defines the directory to which JavaScript files will be installed and
-defaults to `/opt/local/share/node`.
+ % npm install websocket
-For example, to install to /foo/bar
-
- % sudo make install INSTALL_DIR=/foo/bar
- install -m 755 -d /foo/bar
- install -m 444 lib/webworker.js lib/webworker-utils.js \
- lib/webworker-child.js /foo/bar
- % find /foo/bar
- /foo/bar
- /foo/bar/webworker-child.js
- /foo/bar/webworker-utils.js
- /foo/bar/webworker.js
+Note that this requires
+[node-websocket-client](http://github.com/pgriess/node-websocket-client) v0.9.3
+or later and
+[node-websocket-server](http://github.com/miksago/node-websocket-server)
+v1.3.00 or later. These dependencies will be handled automatically by `npm`,
+but must be dealt with manually if installing using another procedure.
View
2  examples/prefork/master.js
@@ -1,6 +1,6 @@
var path = require('path');
var netBindings = process.binding('net');
-var Worker = require('webworker').Worker;
+var Worker = require('../lib/webworker').Worker;
var fd = netBindings.socket('tcp4');
netBindings.bind(fd, 80);
View
4 lib/webworker-child.js
@@ -20,8 +20,8 @@ var sys = require('sys');
var wwutil = require('./webworker-util');
try {
- var WebSocketServer = require('ws').WebSocketServer;
- var WebSocket = require('websocket').WebSocket;
+ var WebSocketServer = require('websocket-server/ws').WebSocketServer;
+ var WebSocket = require('websocket-client/websocket').WebSocket;
} catch (e) {
throw new Error(
'Both miksago/node-websocket-server and ' +
View
4 lib/webworker.js
@@ -38,8 +38,8 @@ var sys = require('sys');
var wwutil = require('./webworker-util');
try {
- var WebSocketServer = require('ws').Server;
- var WebSocket = require('websocket').WebSocket;
+ var WebSocketServer = require('websocket-server/ws').Server;
+ var WebSocket = require('websocket-client/websocket').WebSocket;
} catch (e) {
throw new Error(
'Both miksago/node-websocket-server and ' +
View
25 package.json
@@ -0,0 +1,25 @@
+{
+ "name" : "webworker",
+ "version" : "0.1.0",
+ "description" : "An implementation of the HTML5 Web Worker API",
+ "author" : "Peter Griess <pg@std.in>",
+ "engines" : {
+ "node" : "0.1.98 - 0.1.199"
+ },
+ "dependencies" : {
+ "websocket-server" : "1.2.00 - 1.2.99999",
+ "websocket-client" : "0.9.2 - 0.9.99999"
+ },
+ "repositories" : [
+ {
+ "type" : "git",
+ "url" : "http://github.com/pgriess/node-webworker"
+ }
+ ],
+ "licenses" : [
+ {
+ "type" : "BSD",
+ "url" : "http://github.com/pgriess/node-webworker/blob/master/LICENSE"
+ }
+ ]
+}
View
2  test/test-error.js
@@ -2,7 +2,7 @@
var assert = require('assert');
var path = require('path');
-var Worker = require('webworker').Worker;
+var Worker = require('../lib/webworker').Worker;
var w = new Worker(path.join(__dirname, 'workers', 'error.js'));
View
2  test/test-fd.js
@@ -5,7 +5,7 @@ var net = require('net');
var netBinding = process.binding('net');
var path = require('path');
var sys = require('sys');
-var Worker = require('webworker').Worker;
+var Worker = require('../lib/webworker').Worker;
var w = new Worker(path.join(__dirname, 'workers', 'fd.js'));
View
2  test/test-simple.js
@@ -4,7 +4,7 @@
var assert = require('assert');
var path = require('path');
var sys = require('sys');
-var Worker = require('webworker').Worker;
+var Worker = require('../lib/webworker').Worker;
var receivedMsg = false;
var receivedExit = false;
Please sign in to comment.
Something went wrong with that request. Please try again.