webworker-threads
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -0,1 +1,12 @@ | ||
## 0.3.1 | ||
* Switch to BSON instead of JSON for message serialization. | ||
Note that neither one supports circular structures or | ||
native buffer objects yet. | ||
## 0.3.0 | ||
* Require Node.js 0.8. | ||
## 0.2.3 | ||
@@ -2,0 +13,0 @@ |
{ | ||
"name": "webworker-threads", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"main": "build/Release/WebWorkerThreads.node", | ||
@@ -21,3 +21,12 @@ "description": "Lightweight Web Worker API implementation with POSIX threads", | ||
}, | ||
"license": "MIT", | ||
"licenses": [ | ||
{ | ||
"type": "Apache License, Version 2.0", | ||
"url": "http://www.apache.org/licenses/LICENSE-2.0" | ||
}, | ||
{ | ||
"type": "MIT", | ||
"url": "file:LICENSE" | ||
} | ||
], | ||
"repository": { | ||
@@ -28,7 +37,7 @@ "type": "git", | ||
"scripts": { | ||
"prepublish": "env PATH=./node_modules/.bin:\"$PATH\" livescript -cj package.ls", | ||
"js": "env PATH=./node_modules/.bin:\"$PATH\" livescript -cj package.ls;\ngcc deps/minifier/src/minify.c -o deps/minifier/bin/minify;\nenv PATH=./node_modules/.bin:\"$PATH\" livescript -cbp src/load.ls > src/load.js;\n./deps/minifier/bin/minify kLoad_js < src/load.js > src/load.js.c;\nenv PATH=./node_modules/.bin:\"$PATH\" livescript -cbp src/worker.ls > src/worker.js;\n./deps/minifier/bin/minify kWorker_js < src/worker.js > src/worker.js.c;\nenv PATH=./node_modules/.bin:\"$PATH\" livescript -cbp src/events.ls > src/events.js;\n./deps/minifier/bin/minify kEvents_js < src/events.js > src/events.js.c;\nenv PATH=./node_modules/.bin:\"$PATH\" livescript -cbp src/thread_nextTick.ls > src/thread_nextTick.js;\n./deps/minifier/bin/minify kThread_nextTick_js 1 < src/thread_nextTick.js > src/thread_nextTick.js.c;\nenv PATH=./node_modules/.bin:\"$PATH\" livescript -cbp src/createPool.ls > src/createPool.js;\n./deps/minifier/bin/minify kCreatePool_js < src/createPool.js > src/createPool.js.c;" | ||
"prepublish": "env PATH=./node_modules/.bin:\"$PATH\" lsc -cj package.ls", | ||
"js": "env PATH=./node_modules/.bin:\"$PATH\" lsc -cj package.ls;\ngcc deps/minifier/src/minify.c -o deps/minifier/bin/minify;\nenv PATH=./node_modules/.bin:\"$PATH\" lsc -cbp src/load.ls > src/load.js;\n./deps/minifier/bin/minify kLoad_js < src/load.js > src/load.js.c;\nenv PATH=./node_modules/.bin:\"$PATH\" lsc -cbp src/worker.ls > src/worker.js;\n./deps/minifier/bin/minify kWorker_js < src/worker.js > src/worker.js.c;\nenv PATH=./node_modules/.bin:\"$PATH\" lsc -cbp src/events.ls > src/events.js;\n./deps/minifier/bin/minify kEvents_js < src/events.js > src/events.js.c;\nenv PATH=./node_modules/.bin:\"$PATH\" lsc -cbp src/thread_nextTick.ls > src/thread_nextTick.js;\n./deps/minifier/bin/minify kThread_nextTick_js 1 < src/thread_nextTick.js > src/thread_nextTick.js.c;\nenv PATH=./node_modules/.bin:\"$PATH\" lsc -cbp src/createPool.ls > src/createPool.js;\n./deps/minifier/bin/minify kCreatePool_js < src/createPool.js > src/createPool.js.c;" | ||
}, | ||
"devDependencies": { | ||
"LiveScript": "*" | ||
"LiveScript": "1.1.x" | ||
}, | ||
@@ -35,0 +44,0 @@ "gypfile": true, |
@@ -7,3 +7,3 @@ # WebWorker Threads | ||
This module requires Node.js 0.6.0 or later. | ||
This module requires Node.js 0.8.0 or later. | ||
@@ -283,5 +283,5 @@ ## Installing the module | ||
##### .dispatchEvent( event ) | ||
Currently unplemented. | ||
Currently unimplemented. | ||
##### .removeEventListener( type ) | ||
Currently unplemented. | ||
Currently unimplemented. | ||
##### .thread | ||
@@ -355,3 +355,3 @@ Returns the underlying `thread` object; see the next section for details. | ||
##### .removeEventListener( type ) | ||
Currently unplemented. | ||
Currently unimplemented. | ||
##### .thread | ||
@@ -387,3 +387,3 @@ Returns the underlying `thread` object; see the next section for details. | ||
[Node.js](http://nodejs.org) is the most [awesome, cute and super-sexy](http://javascriptology.com/webworker-threads/sexy.jpg) piece of free, open source software. | ||
[Node.js](http://nodejs.org) is the most awesome, cute and super-sexy piece of free, open source software. | ||
@@ -390,0 +390,0 @@ Its event loop can spin as fast and smooth as a turbo, and roughly speaking, **the faster it spins, the more power it delivers**. That's why [@ryah](http://twitter.com/ryah) took great care to ensure that no -possibly slow- I/O operations could ever block it: a pool of background threads (thanks to [Marc Lehmann's libeio library](http://software.schmorp.de/pkg/libeio.html)) handle any blocking I/O calls in the background, in parallel. |
@@ -29,5 +29,3 @@ function ThreadNextTick(){ | ||
self.addEventListener = function(event, cb){ | ||
return this.thread.on(event, function(json){ | ||
return cb(JSON.parse(json)); | ||
}); | ||
return this.thread.on(event, cb); | ||
}; | ||
@@ -34,0 +32,0 @@ self.close = function(){ |
@@ -9,5 +9,5 @@ function Worker(){ | ||
this.thread = t = Threads.create(); | ||
t.on('message', function(json){ | ||
t.on('message', function(args){ | ||
return typeof this$.onmessage === 'function' ? this$.onmessage({ | ||
data: JSON.parse(json) | ||
data: args | ||
}) : void 8; | ||
@@ -29,8 +29,8 @@ }); | ||
this.dispatchEvent = function(event){ | ||
return t.emit(event.type, JSON.stringify(event)); | ||
return t.emitSerialized(event.type, event); | ||
}; | ||
this.postMessage = function(data){ | ||
return t.emit('message', JSON.stringify({ | ||
return t.emitSerialized('message', { | ||
data: data | ||
})); | ||
}); | ||
}; | ||
@@ -37,0 +37,0 @@ if (typeof code === 'function') { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
231915
100
1746