Comparing version 3.0.10 to 3.0.11
54
dot.js
@@ -7,5 +7,3 @@ /*global Map Promise Set*/ | ||
// | ||
var after = ["after"], | ||
before = ["before"], | ||
empty = "", | ||
var empty = "", | ||
fnType = "function", | ||
@@ -20,19 +18,16 @@ period = ".", | ||
r = {}, | ||
s = { | ||
anyMap: new Map(), | ||
onMap: new Map(), | ||
} | ||
s = {} | ||
dot = r.dot = setup.bind({ fn: emit, r: r, s: s }) | ||
dot.reset = reset.bind({ s: s }) | ||
dot.reset() | ||
dot.off = setup.bind({ fn: off, s: s }) | ||
dot.on = setup.bind({ fn: on, m: "onMap", r: r, s: s }) | ||
dot.onAny = setup.bind({ | ||
fn: on, | ||
m: "anyMap", | ||
r: r, | ||
s: s, | ||
}) | ||
dot.reset = reset.bind({ s: s }) | ||
dot.state = s | ||
Object.keys(s).forEach(function(m) { | ||
dot[m] = setup.bind({ fn: on, m: m, r: r, s: s }) | ||
}) | ||
return dot | ||
@@ -105,4 +100,2 @@ } | ||
}, | ||
ka = after.concat(k.arr), | ||
kb = before.concat(k.arr), | ||
sig1 = {}, | ||
@@ -112,9 +105,9 @@ sig2 = {} | ||
var promise = Promise.all([ | ||
callOnAny(arg, kb, s.anyMap, sig1), | ||
callOn(arg, kb, s.onMap, sig2), | ||
callOnAny(arg, k.arr, s.beforeAny, sig1), | ||
callOn(arg, k.arr, s.beforeOn, sig2), | ||
]) | ||
.then(function() { | ||
return Promise.all([ | ||
callOnAny(arg, k.arr, s.anyMap, sig1), | ||
callOn(arg, k.arr, s.onMap, sig2), | ||
callOnAny(arg, k.arr, s.any, sig1), | ||
callOn(arg, k.arr, s.on, sig2), | ||
]) | ||
@@ -124,4 +117,4 @@ }) | ||
return Promise.all([ | ||
callOnAny(arg, ka, s.anyMap, sig1), | ||
callOn(arg, ka, s.onMap, sig2), | ||
callOnAny(arg, k.arr, s.afterAny, sig1), | ||
callOn(arg, k.arr, s.afterOn, sig2), | ||
]) | ||
@@ -200,10 +193,13 @@ }) | ||
function reset() { | ||
this.s.anyMap = new Map() | ||
this.s.onMap = new Map() | ||
for (var k in this.s) { | ||
if (!(this.s[k] instanceof Map)) { | ||
this.s[k] = undefined | ||
} | ||
this.s[k] = undefined | ||
} | ||
Object.assign(this.s, { | ||
afterAny: new Map(), | ||
afterOn: new Map(), | ||
any: new Map(), | ||
beforeAny: new Map(), | ||
beforeOn: new Map(), | ||
on: new Map(), | ||
}) | ||
} | ||
@@ -210,0 +206,0 @@ |
@@ -55,3 +55,3 @@ /* eslint-env jest */ | ||
dot.on("after.a", "b", "c", function() { | ||
dot.afterOn("a", "b", "c", function() { | ||
order.push(3) | ||
@@ -64,3 +64,3 @@ }) | ||
dot.on("before.a.b", "c", function() { | ||
dot.beforeOn("a.b", "c", function() { | ||
order.push(1) | ||
@@ -77,3 +77,3 @@ }) | ||
dot.on("before.a.b", "c", function(opt, sig) { | ||
dot.beforeOn("a.b", "c", function(opt, sig) { | ||
sig.cancel = true | ||
@@ -92,3 +92,3 @@ }) | ||
test("on value", function() { | ||
dot.on("before.a.b", "c", function(opt, sig) { | ||
dot.beforeOn("a.b", "c", function(opt, sig) { | ||
sig.value = true | ||
@@ -103,3 +103,3 @@ }) | ||
dot.onAny(function() { | ||
dot.any(function() { | ||
called = true | ||
@@ -116,3 +116,3 @@ }) | ||
dot.onAny("a", function() { | ||
dot.any("a", function() { | ||
called = true | ||
@@ -129,11 +129,11 @@ }) | ||
dot.onAny("after.a.b", function() { | ||
dot.afterAny("a.b", function() { | ||
order.push(3) | ||
}) | ||
dot.onAny("a", function() { | ||
dot.any("a", function() { | ||
order.push(2) | ||
}) | ||
dot.onAny("before.a", function() { | ||
dot.beforeAny("a", function() { | ||
order.push(1) | ||
@@ -140,0 +140,0 @@ }) |
{ | ||
"name": "dot-event", | ||
"version": "3.0.10", | ||
"version": "3.0.11", | ||
"description": "Powerful event emitter", | ||
@@ -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
10249
373