Permalink
Browse files

Refactoring listen -> observe

  • Loading branch information...
1 parent 12e85e9 commit 560bc794ccd8b38c6b38bf8caa7adf5f5fad3981 @kriszyp kriszyp committed Feb 16, 2010
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/json-rpc.js
View
@@ -14,7 +14,7 @@
* });
*
*/
-var addListener = require("listen").addListener,
+var observe = require("observe").observe,
when = require("promise").when;
var invoke = exports.invoke = function(target, rpc){
@@ -59,9 +59,9 @@ var invoke = exports.invoke = function(target, rpc){
exports.server = function(rpcObject){
if (global.onmessage) // dedicated worker
- addListener(global, "onmessage", handleMessage);
+ observe(global, "onmessage", handleMessage);
else // shared worker
- addListener(global, "onconnect", function (e) { e.port.onmessage = handleMessage; });
+ observe(global, "onconnect", function (e) { e.port.onmessage = handleMessage; });
function handleMessage(event){
var data = event.data;
@@ -77,7 +77,7 @@ exports.client = function(worker){
worker = worker.port;
}
var requestsWaiting = {};
- addListener(worker, "onmessage", function(event){
+ observe(worker, "onmessage", function(event){
var data = event.data;
if(requestsWaiting[data.id]){
if(data.error === null){
@@ -105,5 +105,5 @@ exports.client = function(worker){
};
};
-var Response = require("./jsgi/response").Response;
+var Response = require("jsgi/response").Response;

0 comments on commit 560bc79

Please sign in to comment.