Comparing version 0.0.5 to 0.1.0
@@ -1,1 +0,1 @@ | ||
function EventLite(){return this instanceof EventLite?void 0:new EventLite}!function(t){function e(t){for(var e in l)t[e]=l[e];return t}function n(t,e){return o(this,t).push(e),this}function i(t,e){function n(){r.call(i,t,n),e.apply(this,arguments)}var i=this;return o(i,t).push(n),i}function r(t,e){function n(t){return t!==e}var i,u=this;if(t){if(e){if(i=o(u,t,!0)){if(i=i.filter(n),!i.length)return r.call(u,t);u[f][t]=i}}else if(i=u[f],i&&(delete i[t],!Object.keys(i).length))return r.call(u)}else delete u[f];return u}function u(t,e){function n(t){t.apply(i,r)}var i=this,r=Array.prototype.slice.call(arguments,1),u=o(i,t,!0);return u?(u.forEach(n),!!u.length):!1}function o(t,e,n){if(!n||t[f]){var i=t[f]||(t[f]={});return i[e]||(i[e]=[])}}"undefined"!=typeof module&&(module.exports=t);var f="listeners",l={on:n,once:i,off:r,emit:u};e(t.prototype),t.mixin=e}(EventLite); | ||
function EventLite(){return this instanceof EventLite?void 0:new EventLite}!function(t){function e(t){for(var e in l)t[e]=l[e];return t}function n(t,e){return u(this,t).push(e),this}function r(t,e){function n(){i.call(r,t,n),e.apply(this,arguments)}var r=this;return u(r,t).push(n),r}function i(t,e){function n(t){return t!==e}var r,f=this;if(t){if(e){if(r=u(f,t,!0)){if(r=r.filter(n),!r.length)return i.call(f,t);f[o][t]=r}}else if(r=f[o],r&&(delete r[t],!Object.keys(r).length))return i.call(f)}else delete f[o];return f}function f(t,e){function n(t){t.call(f)}function r(t){t.call(f,e)}function i(t){t.apply(f,c)}var f=this,o=u(f,t,!0);if(!o)return!1;var l=arguments.length;if(1===l)o.forEach(n);else if(2===l)o.forEach(r);else{var c=Array.prototype.slice.call(arguments,1);o.forEach(i)}return!!o.length}function u(t,e,n){if(!n||t[o]){var r=t[o]||(t[o]={});return r[e]||(r[e]=[])}}"undefined"!=typeof module&&(module.exports=t);var o="listeners",l={on:n,once:r,off:i,emit:f};e(t.prototype),t.mixin=e}(EventLite); |
@@ -143,9 +143,24 @@ /** | ||
var that = this; | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
var listeners = getListeners(that, type, true); | ||
if (!listeners) return false; | ||
listeners.forEach(run); | ||
var arglen = arguments.length; | ||
if (arglen === 1) { | ||
listeners.forEach(zeroarg); | ||
} else if (arglen === 2) { | ||
listeners.forEach(onearg); | ||
} else { | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
listeners.forEach(moreargs); | ||
} | ||
return !!listeners.length; | ||
function run(func) { | ||
function zeroarg(func) { | ||
func.call(that); | ||
} | ||
function onearg(func) { | ||
func.call(that, value); | ||
} | ||
function moreargs(func) { | ||
func.apply(that, args); | ||
@@ -152,0 +167,0 @@ } |
{ | ||
"name": "event-lite", | ||
"version": "0.0.5", | ||
"description": "Light-weight EventEmitter (less than 1KB when minified)", | ||
"main": "event-lite.js", | ||
"scripts": { | ||
"test": "make test" | ||
"version": "0.1.0", | ||
"author": "@kawanet", | ||
"bugs": { | ||
"url": "https://github.com/kawanet/event-lite/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/kawanet/event-lite.git" | ||
"devDependencies": { | ||
"jsdoc": "^3.3.2", | ||
"jshint": "^2.8.0", | ||
"mocha": "^2.3.0", | ||
"uglify-js": "^2.4.24", | ||
"zuul": "^3.4.0" | ||
}, | ||
"author": "@kawanet", | ||
"license": "MIT", | ||
"homepage": "https://github.com/kawanet/event-lite", | ||
"jshintConfig": { | ||
"mocha": true, | ||
"node": true, | ||
"undef": true | ||
}, | ||
"keywords": [ | ||
"browser", | ||
"emitter", | ||
"event", | ||
"emitter", | ||
"eventlistener", | ||
"fire", | ||
"trigger" | ||
], | ||
"devDependencies": { | ||
"jsdoc": "^3.3.2", | ||
"jshint": "^2.8.0", | ||
"mocha": "^2.2.5", | ||
"uglify-js": "^2.4.23" | ||
"license": "MIT", | ||
"main": "event-lite.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/kawanet/event-lite.git" | ||
}, | ||
"jshintConfig": { | ||
"undef": true, | ||
"globals": { | ||
"module": true | ||
} | ||
"scripts": { | ||
"test": "make test" | ||
} | ||
} |
@@ -1,5 +0,7 @@ | ||
# event-lite.js [![Build Status](https://travis-ci.org/kawanet/event-lite.svg?branch=master)](https://travis-ci.org/kawanet/event-lite) | ||
# event-lite.js [![npm version](https://badge.fury.io/js/event-lite.svg)](http://badge.fury.io/js/event-lite) [![Build Status](https://travis-ci.org/kawanet/event-lite.svg?branch=master)](https://travis-ci.org/kawanet/event-lite) | ||
Light-weight EventEmitter (less than 1KB when minified) | ||
[![Sauce Test Status](https://saucelabs.com/browser-matrix/event-lite.svg)](https://saucelabs.com/u/event-lite) | ||
### Usage | ||
@@ -6,0 +8,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
21055
15
414
0
71
5