Comparing version 0.0.4 to 0.0.5
## v0.0.5 - Jan 04 2018 | ||
+ Adds basic console message when publishing to a topic that has not matching subscribers. I will likely make this configurable later. | ||
## v0.0.4 - Jan 02 2018 | ||
+ Fixes race condition that caused subscribers to be called with topic value at time of subscriber call instead of published value. |
'use strict'; | ||
/* | ||
* Pubby - Basic JavaScript Pub/Sub Event Emitter | ||
* Pubst - Basic JavaScript Pub/Sub Event Emitter | ||
* | ||
@@ -53,5 +53,10 @@ * Copyright 2017 Jason Schindler | ||
subs.forEach(function (sub) { | ||
scheduleCall(sub, store[topic], topic); | ||
}); | ||
if (subs.length === 0) { | ||
// eslint-disable-next-line no-console | ||
console.warn('WARNING:: There are no subscribers that match \'' + topic + '\'!'); | ||
} else { | ||
subs.forEach(function (sub) { | ||
scheduleCall(sub, store[topic], topic); | ||
}); | ||
} | ||
} | ||
@@ -58,0 +63,0 @@ } |
{ | ||
"name": "pubst", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Basic JavaScript Pub/Sub Event Emitter", | ||
@@ -5,0 +5,0 @@ "main": "lib/pubst.js", |
@@ -8,3 +8,3 @@ # Pubst | ||
+ Allow subscribers to define default payloads to be sent in the event of an empty or `null` publish. | ||
+ Warnings when publishing to a topic that has no subscribers. (Not implemented here either) | ||
+ Warnings when publishing to a topic that has no subscribers. | ||
+ Allow for a subscription to all topics. (Not implemented here either) | ||
@@ -11,0 +11,0 @@ |
/* | ||
* Pubby - Basic JavaScript Pub/Sub Event Emitter | ||
* Pubst - Basic JavaScript Pub/Sub Event Emitter | ||
* | ||
@@ -51,5 +51,10 @@ * Copyright 2017 Jason Schindler | ||
subs.forEach(sub => { | ||
scheduleCall(sub, store[topic], topic); | ||
}); | ||
if (subs.length === 0) { | ||
// eslint-disable-next-line no-console | ||
console.warn(`WARNING:: There are no subscribers that match '${topic}'!`); | ||
} else { | ||
subs.forEach(sub => { | ||
scheduleCall(sub, store[topic], topic); | ||
}); | ||
} | ||
} | ||
@@ -56,0 +61,0 @@ } |
26447
330