protoblast
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -0,1 +1,5 @@ | ||
## 0.1.7 (2015-03-04) | ||
* Fixed event listeners stop() context function | ||
## 0.1.6 (2015-02-27) | ||
@@ -2,0 +6,0 @@ |
@@ -630,3 +630,3 @@ module.exports = function BlastInformer(Blast, Collection) { | ||
* @since 0.1.3 | ||
* @version 0.1.6 | ||
* @version 0.1.7 | ||
* | ||
@@ -706,4 +706,4 @@ * @param {String|Object} type | ||
// Skip the first 2 items, or if we've been stopped | ||
if (index < 2 || shouldBeStopped) return; | ||
// Skip the first 2 items | ||
if (index < 2) return; | ||
@@ -718,2 +718,3 @@ listener = list[0]; | ||
context.wait = wait; | ||
context.stop = stop; | ||
@@ -727,2 +728,6 @@ // Store async config in another object, | ||
if (shouldBeStopped) { | ||
return next(); | ||
} | ||
// Start execusting the function | ||
@@ -748,4 +753,5 @@ switch (argLength) { | ||
if (this.ListenerSaysStop) { | ||
if (context.ListenerSaysStop) { | ||
shouldBeStopped = true; | ||
return next(); | ||
} | ||
@@ -752,0 +758,0 @@ |
{ | ||
"name": "protoblast", | ||
"description": "Handy functions for several classes' prototype", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"author": "Jelle De Loecker <jelle@codedor.be>", | ||
@@ -6,0 +6,0 @@ "keywords": ["prototype", "util", "functional", "server", "client", "browser"], |
@@ -134,2 +134,38 @@ var assert = require('assert'), | ||
describe('addListener("type", listener) -- stop propagation', function() { | ||
it('should stop propagation', function() { | ||
var aTest = new Blast.Classes.Informer(), | ||
val = 0; | ||
aTest.on('test', function t1() { | ||
// Increment the value | ||
val++; | ||
// Stop propagation | ||
this.stop(); | ||
}); | ||
// Add some other listeners | ||
aTest.on('test', function shouldnotrun() { | ||
// Increment value | ||
val++; | ||
}); | ||
// Add some other listeners | ||
aTest.on('test', function shouldnotruneither() { | ||
// Increment value | ||
val++; | ||
}); | ||
aTest.emit('test'); | ||
assert.equal(1, val); | ||
aTest.emit('test'); | ||
assert.equal(2, val); | ||
}); | ||
}); | ||
describe('addListener("typeName", listener, context)', function() { | ||
@@ -136,0 +172,0 @@ |
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
497920
15591