Permalink
Browse files

Use "on" as the listener function

  • Loading branch information...
1 parent 8787219 commit 548b2c76cdf9c9eef54cc5eebf5ee48b2ea7cd64 @kriszyp committed Aug 27, 2010
Showing with 6 additions and 3 deletions.
  1. +2 −2 lib/connector.js
  2. +3 −0 lib/hub.js
  3. +1 −1 lib/queue.js
View
@@ -4,7 +4,7 @@
var hub = require("./hub");
var callbacks = [];
var connections = [];
-exports.observe = function(name, callback){
+exports.on = exports.observe = function(name, callback){
connections.forEach(callback);
callbacks.push(callback);
}
@@ -13,7 +13,7 @@ exports.Connector = function(clientId, connection){
connections.push(connection);
var ourHub = hub.fromClient(clientId);
ourHub.subscribe("**", "monitored", onSubscription);
- connection.observe("message", function(message){
+ connection.on("message", function(message){
if(typeof message.channel === "string"){
if(message.method === "subscribe"){
ourHub.subscribe(message.channel, message.subscribe, function(message){
View
@@ -112,6 +112,9 @@ exports.subscribe= function(channel, /*String?*/eventName, listener){
responses.observe = function(callback){
listeners.push(callback);
}
+ responses.on = function(event, callback){
+ listeners.push(callback);
+ }
return responses;
};
View
@@ -146,7 +146,7 @@ connectionPrototype.__proto__ = Array.prototype;
connector.observe("connector", function(hubConnection){
hubConnections.push(hubConnection);
- hubConnection.observe("message", function(message){
+ hubConnection.on("message", function(message){
if(message.requestedClientId){
var requestedClientId = message.requestedClientId;
if(message.active){

0 comments on commit 548b2c7

Please sign in to comment.