Sorry, the diff of this file is not supported yet
+10
| // minivents - created with Gulp Fiction | ||
| var gulp = require('gulp'); | ||
| var uglify = require('gulp-uglify'); | ||
| var rename = require('gulp-rename'); | ||
| gulp.task('default', [], function () { | ||
| gulp.src('./minivents.js') | ||
| .pipe(uglify()) | ||
| .pipe(rename('minivents.min.js')) | ||
| .pipe(gulp.dest('./')); | ||
| }); |
+9
-11
@@ -1,6 +0,3 @@ | ||
| /** | ||
| * Events | ||
| */ | ||
| function Events(target){ | ||
| var events = {}, i, list, args, A = Array; | ||
| var events = {}; | ||
| target = target || this | ||
@@ -18,5 +15,5 @@ /** | ||
| target.off = function(type, func){ | ||
| list = events[type] || [] | ||
| var list = events[type] || [], | ||
| i = list.length = func ? list.length : 0 | ||
| while(~--i<0) func == list[i].f && list.splice(i,1) | ||
| while(i-->0) func == list[i].f && list.splice(i,1) | ||
| } | ||
@@ -27,8 +24,9 @@ /** | ||
| target.emit = function(){ | ||
| args = A.apply([], arguments) | ||
| list = events[args.shift()] || [] | ||
| i = list.length | ||
| for(j=0;j<i;j++) list[j].f.apply(list[j].c, args) | ||
| var args = Array.apply([], arguments), | ||
| list = events[args.shift()] || [], | ||
| i = list.length, j | ||
| for(j=0;j<i;j++) list[j].f.apply(list[j].c, args) | ||
| }; | ||
| } | ||
| module.exports = Events | ||
| var u, module, cjs = module != u; | ||
| (cjs ? module : window)[(cjs ? 'exports' : 'Events')] = Events; |
+1
-1
@@ -1,1 +0,1 @@ | ||
| function Events(a){var c,d,e,b={},f=Array;a=a||this,a.on=function(a,c,d){b[a]||(b[a]=[]),b[a].push({f:c,c:d})},a.off=function(a,e){for(d=b[a]||[],c=d.length=e?d.length:0;~--c<0;)e==d[c].f&&d.splice(c,1)},a.emit=function(){for(e=f.apply([],arguments),d=b[e.shift()]||[],c=d.length,j=0;c>j;j++)d[j].f.apply(d[j].c,e)}}module.exports=Events; | ||
| function Events(n){var t={};n=n||this,n.on=function(n,e,o){t[n]||(t[n]=[]),t[n].push({f:e,c:o})},n.off=function(n,e){for(var o=t[n]||[],f=o.length=e?o.length:0;f-->0;)e==o[f].f&&o.splice(f,1)},n.emit=function(){var n,e=Array.apply([],arguments),o=t[e.shift()]||[],f=o.length;for(n=0;f>n;n++)o[n].f.apply(o[n].c,e)}}var u,module,cjs=module!=u;(cjs?module:window)[cjs?"exports":"Events"]=Events; |
+8
-2
| { | ||
| "name": "minivents", | ||
| "version": "1.1.1", | ||
| "version": "1.1.2", | ||
| "description": "Tiny eventing for javascript", | ||
@@ -10,3 +10,4 @@ "main": "minivents.js", | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| "test": "echo \"Error: no test specified\" && exit 1", | ||
| "build": "gulp" | ||
| }, | ||
@@ -24,2 +25,7 @@ "repository": { | ||
| }, | ||
| "devDependencies": { | ||
| "gulp": "~3.6.2", | ||
| "gulp-uglify": "~0.3.0", | ||
| "gulp-rename": "~1.2.0" | ||
| }, | ||
| "license": "MIT", | ||
@@ -26,0 +32,0 @@ "bugs": { |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
7031
8.45%8
33.33%102
6.25%3
Infinity%