pub-once-sub
Advanced tools
Comparing version 0.6.0 to 0.7.0
@@ -5,2 +5,3 @@ var PubSub = require('../'); | ||
pubSub.subscribe('test'); | ||
pubSub.subscribe('test2'); | ||
@@ -10,3 +11,11 @@ pubSub.publish('test', 'one'); | ||
pubSub.publish('test', 'three'); | ||
pubSub.publish('test2', 'test2'); | ||
pubSub.on('test2', function(data) { | ||
pubSub.publish('test', '2'); | ||
pubSub.publish('test', '3'); | ||
pubSub.publish('test', '7'); | ||
console.log(data); | ||
}); | ||
pubSub.on('test', function(data) { | ||
@@ -18,6 +27,7 @@ console.log(data); | ||
pubSub2.subscribe('test'); | ||
pubSub2.subscribe('test2'); | ||
pubSub2.on('test', function(data) { | ||
pubSub2.on('test2', function(data) { | ||
console.log(data); | ||
}); | ||
@@ -16,2 +16,6 @@ var EventEmitter = require('events').EventEmitter; | ||
this.on('error', function(error) { | ||
console.log(error); | ||
}); | ||
var self = this; | ||
@@ -21,4 +25,9 @@ | ||
self.redis.blpop(channel, 0, function(err, res) { | ||
console.log(res); | ||
if (res) { | ||
self.emit(channel, message); | ||
try { | ||
self.emit(channel, res[1]); | ||
} catch (error) { | ||
self.emit('error', error); | ||
} | ||
} | ||
@@ -44,3 +53,3 @@ }); | ||
var self = this; | ||
self.redis.lpush(channel, message, function(err, res) { | ||
self.redis.rpush(channel, message, function(err, res) { | ||
self.pub.publish(channel, message); | ||
@@ -47,0 +56,0 @@ }); |
{ | ||
"name": "pub-once-sub", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": ".", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2963
93