Comparing version 2.1.0 to 2.2.0
@@ -9,2 +9,3 @@ define([], function() { return function Events(target){ | ||
(events[type] = events[type] || []).push([func, ctx]) | ||
return target | ||
} | ||
@@ -19,2 +20,3 @@ /** | ||
while(i--) func == list[i][0] && list.splice(i,1) | ||
return target | ||
} | ||
@@ -27,3 +29,4 @@ /** | ||
while(j=list[i++]) j[0].apply(j[1], empty.slice.call(arguments, 1)) | ||
return target | ||
}; | ||
}; }); |
@@ -1,1 +0,1 @@ | ||
define([],function(){return function(n){var t={},e=[];n=n||this,n.on=function(n,e,i){(t[n]=t[n]||[]).push([e,i])},n.off=function(n,i){n||(t={});for(var f=t[n]||e,l=f.length=i?f.length:0;l--;)i==f[l][0]&&f.splice(l,1)},n.emit=function(n){for(var i,f=t[n]||e,l=f.length>0?f.slice(0,f.length):f,c=0;i=l[c++];)i[0].apply(i[1],e.slice.call(arguments,1))}}}); | ||
define([],function(){return function(n){var t={},e=[];n=n||this,n.on=function(e,r,i){return(t[e]=t[e]||[]).push([r,i]),n},n.off=function(r,i){r||(t={});for(var u=t[r]||e,f=u.length=i?u.length:0;f--;)i==u[f][0]&&u.splice(f,1);return n},n.emit=function(r){for(var i,u=t[r]||e,f=u.length>0?u.slice(0,u.length):u,l=0;i=f[l++];)i[0].apply(i[1],e.slice.call(arguments,1));return n}}}); |
@@ -9,2 +9,3 @@ module.exports = function Events(target){ | ||
(events[type] = events[type] || []).push([func, ctx]) | ||
return target | ||
} | ||
@@ -19,2 +20,3 @@ /** | ||
while(i--) func == list[i][0] && list.splice(i,1) | ||
return target | ||
} | ||
@@ -27,3 +29,4 @@ /** | ||
while(j=list[i++]) j[0].apply(j[1], empty.slice.call(arguments, 1)) | ||
return target | ||
}; | ||
}; |
@@ -1,1 +0,1 @@ | ||
module.exports=function(n){var t={},e=[];n=n||this,n.on=function(n,e,l){(t[n]=t[n]||[]).push([e,l])},n.off=function(n,l){n||(t={});for(var o=t[n]||e,i=o.length=l?o.length:0;i--;)l==o[i][0]&&o.splice(i,1)},n.emit=function(n){for(var l,o=t[n]||e,i=o.length>0?o.slice(0,o.length):o,c=0;l=i[c++];)l[0].apply(l[1],e.slice.call(arguments,1))}}; | ||
module.exports=function(n){var t={},e=[];n=n||this,n.on=function(e,r,l){return(t[e]=t[e]||[]).push([r,l]),n},n.off=function(r,l){r||(t={});for(var o=t[r]||e,u=o.length=l?o.length:0;u--;)l==o[u][0]&&o.splice(u,1);return n},n.emit=function(r){for(var l,o=t[r]||e,u=o.length>0?o.slice(0,o.length):o,i=0;l=u[i++];)l[0].apply(l[1],e.slice.call(arguments,1));return n}}; |
@@ -9,2 +9,3 @@ function Events(target){ | ||
(events[type] = events[type] || []).push([func, ctx]) | ||
return target | ||
} | ||
@@ -19,2 +20,3 @@ /** | ||
while(i--) func == list[i][0] && list.splice(i,1) | ||
return target | ||
} | ||
@@ -27,3 +29,4 @@ /** | ||
while(j=list[i++]) j[0].apply(j[1], empty.slice.call(arguments, 1)) | ||
return target | ||
}; | ||
}; |
@@ -1,1 +0,1 @@ | ||
function Events(n){var t={},e=[];n=n||this,n.on=function(n,e,l){(t[n]=t[n]||[]).push([e,l])},n.off=function(n,l){n||(t={});for(var i=t[n]||e,c=i.length=l?i.length:0;c--;)l==i[c][0]&&i.splice(c,1)},n.emit=function(n){for(var l,i=t[n]||e,c=i.length>0?i.slice(0,i.length):i,f=0;l=c[f++];)l[0].apply(l[1],e.slice.call(arguments,1))}} | ||
function Events(n){var t={},e=[];n=n||this,n.on=function(e,r,l){return(t[e]=t[e]||[]).push([r,l]),n},n.off=function(r,l){r||(t={});for(var i=t[r]||e,u=i.length=l?i.length:0;u--;)l==i[u][0]&&i.splice(u,1);return n},n.emit=function(r){for(var l,i=t[r]||e,u=i.length>0?i.slice(0,i.length):i,c=0;l=u[c++];)l[0].apply(l[1],e.slice.call(arguments,1));return n}} |
{ | ||
"name": "minivents", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Tiny eventing for javascript", | ||
@@ -5,0 +5,0 @@ "main": "dist/minivents.commonjs.js", |
@@ -7,7 +7,7 @@ # minivents [![Build Status](https://travis-ci.org/allouis/minivents.svg?branch=master)](https://travis-ci.org/allouis/minivents) | ||
`on` : Listen to event. Params { type:`String`, callback:`Function` | context:`Object` } | ||
`on` : Listen to event. Params { type:`String`, callback:`Function` | context:`Object` }. Returns `target`. | ||
`off` : Stop listening to event. Params { type:`String` | callback:`Function` } | ||
`off` : Stop listening to event. Params { type:`String` | callback:`Function` }. Returns `target`. | ||
`emit`: Emit event. Params { type:`String` | data:`Object` } | ||
`emit`: Emit event. Params { type:`String` | data:`Object` }. Returns `target`. | ||
@@ -14,0 +14,0 @@ # Constructor Example |
@@ -9,2 +9,3 @@ function Events(target){ | ||
(events[type] = events[type] || []).push([func, ctx]) | ||
return target | ||
} | ||
@@ -19,2 +20,3 @@ /** | ||
while(i--) func == list[i][0] && list.splice(i,1) | ||
return target | ||
} | ||
@@ -27,3 +29,4 @@ /** | ||
while(j=list[i++]) j[0].apply(j[1], empty.slice.call(arguments, 1)) | ||
return target | ||
}; | ||
} |
16
test.js
@@ -76,2 +76,6 @@ var assert = require('assert'), | ||
it('should return target', function () { | ||
var bus = new Events(); | ||
assert.equal(bus.on('ping', function () { }), bus); | ||
}); | ||
}); | ||
@@ -121,2 +125,8 @@ | ||
it('should return target', function () { | ||
var bus = new Events(), | ||
f = function () { }; | ||
bus.on('ping', f); | ||
assert.equal(bus.off('ping'), bus); | ||
}); | ||
}); | ||
@@ -200,2 +210,8 @@ | ||
it('should return target', function () { | ||
var bus = new Events(), | ||
f = function () { }; | ||
bus.on('ping', f); | ||
assert.equal(bus.emit('ping'), bus); | ||
}); | ||
}); |
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
16086
403