@valerii-zinchenko/observer
Advanced tools
Comparing version 1.0.2 to 1.0.3
(function (root, factory) { | ||
if (root === undefined && window !== undefined) root = window; | ||
if (typeof define === 'function' && define.amd) { | ||
@@ -21,4 +22,4 @@ // AMD. Register as an anonymous module unless amdModuleId is set | ||
* Copyright (c) 2016-2018 Valerii Zinchenko | ||
* Licensed under MIT (https://github.com/valerii-zinchenko/observer/blob/master/LICENSE.txt). | ||
* All source files are available at: http://github.com/valerii-zinchenko/observer | ||
* Licensed under MIT (https://gitlab.com/valerii-zinchenko/observer/blob/master/LICENSE.txt). | ||
* All source files are available at: http://gitlab.com/valerii-zinchenko/observer | ||
*/ | ||
@@ -25,0 +26,0 @@ |
// Simple tool to work with events. | ||
// v1.0.2 | ||
// v1.0.3 | ||
// Copyright (c) 2016-2018 Valerii Zinchenko | ||
// License: MIT http://valerii-zinchenko.github.io/observer/blob/master/LICENSE.txt | ||
// All source files are available at: http://github.com/[object Object] | ||
// License: MIT http://valerii-zinchenko.gitlab.io/observer/blob/master/LICENSE.txt | ||
// All source files are available at: https://gitlab.com/valerii-zinchenko/observer#readme | ||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return a.Observer=b()}):"object"==typeof module&&module.exports?module.exports=b():a.Observer=b()}(this,function(){"use strict";function a(a,b){if(!this)throw new Error('"new" operator is required');this._events={},this.listen.apply(this,arguments)}return a.prototype._events={},a.prototype.listen=function(a,b){switch(Object.prototype.toString.call(a)){case"[object Object]":var c=a;for(a in c)this.listen(a,c[a]);break;case"[object String]":this._events[a]||(this._events[a]=[]),this._events[a].push(b)}},a.prototype.trigger=function(a){var b=this._events[a];if(b&&0!==b.length)for(var c=Array.prototype.slice.call(arguments,1),d=0,e=b.length;d<e;d++)try{b[d].apply(this,c)}catch(b){console.warn('An error was thrown for the event "'+a+'" in the handler #'+d+":",b)}},a.prototype.removeListener=function(a,b){var c=this._events[a];if(c){for(var d=0,e=c.length;d<e;d++)if(c[d]===b){c.splice(d,1);break}0===c.length&&delete this._events[a]}},a}); | ||
!function(e,t){void 0===e&&void 0!==window&&(e=window),"function"==typeof define&&define.amd?define([],function(){return e.Observer=t()}):"object"==typeof module&&module.exports?module.exports=t():e.Observer=t()}(this,function(){"use strict";function e(e,t){if(!this)throw new Error('"new" operator is required');this._events={},this.listen.apply(this,arguments)}return e.prototype._events={},e.prototype.listen=function(e,t){switch(Object.prototype.toString.call(e)){case"[object Object]":var n=e;for(e in n)this.listen(e,n[e]);break;case"[object String]":this._events[e]||(this._events[e]=[]),this._events[e].push(t)}},e.prototype.trigger=function(t){var e=this._events[t];if(e&&0!==e.length)for(var n=Array.prototype.slice.call(arguments,1),r=0,o=e.length;r<o;r++)try{e[r].apply(this,n)}catch(e){console.warn('An error was thrown for the event "'+t+'" in the handler #'+r+":",e)}},e.prototype.removeListener=function(e,t){var n=this._events[e];if(n){for(var r=0,o=n.length;r<o;r++)if(n[r]===t){n.splice(r,1);break}0===n.length&&delete this._events[e]}},e}); |
109
Gruntfile.js
@@ -9,4 +9,4 @@ module.exports = function(grunt) { | ||
'// Copyright (c) 2016-2018 <%= pkg.author %>\n' + | ||
'// License: <%= pkg.license %> http://valerii-zinchenko.github.io/observer/blob/master/LICENSE.txt\n' + | ||
'// All source files are available at: http://github.com/<%= pkg.repository %>\n'; | ||
'// License: <%= pkg.license %> http://valerii-zinchenko.gitlab.io/observer/blob/master/LICENSE.txt\n' + | ||
'// All source files are available at: <%= pkg.homepage %>\n'; | ||
@@ -53,71 +53,2 @@ grunt.initConfig({ | ||
template: { | ||
test: { | ||
options: { | ||
data: { | ||
isPROD: false, | ||
jsFolder: '../' + src | ||
} | ||
}, | ||
files: { | ||
'<%= pkg.directories.test %>/index.html': ['<%= pkg.directories.test %>/index.tpl.html'] | ||
} | ||
}, | ||
coverage: { | ||
options: { | ||
data: { | ||
isPROD: false, | ||
jsFolder: '../tmp-cov/' | ||
} | ||
}, | ||
files: { | ||
'<%= pkg.directories.test %>/index.html': ['<%= pkg.directories.test %>/index.tpl.html'] | ||
} | ||
}, | ||
'gh-pages': { | ||
options: { | ||
data: { | ||
isPROD: true | ||
} | ||
}, | ||
files: { | ||
'<%= pkg.directories.test %>/index.html': ['<%= pkg.directories.test %>/index.tpl.html'] | ||
} | ||
} | ||
}, | ||
prepareForCoverage: { | ||
instrument: { | ||
files: [{ | ||
expand: true, | ||
cwd: src, | ||
src: '*.js', | ||
dest: 'tmp-cov' | ||
}] | ||
} | ||
}, | ||
mocha: { | ||
test: { | ||
options: { | ||
run: false, | ||
reporter: 'Spec', | ||
log: true, | ||
logErrors: true | ||
}, | ||
src: ['<%= pkg.directories.test %>/index.html'] | ||
}, | ||
coverage: { | ||
options: { | ||
run: false, | ||
reporter: 'Spec', | ||
log: true, | ||
logErrors: true, | ||
coverage: { | ||
htmlReport: '<%= pkg.directories.coverage %>' | ||
} | ||
}, | ||
src: ['<%= pkg.directories.test %>/index.html'] | ||
} | ||
}, | ||
jsdoc: { | ||
@@ -128,2 +59,3 @@ options: { | ||
/* | ||
doc: { | ||
@@ -135,2 +67,3 @@ src: src + '*.js', | ||
}, | ||
*/ | ||
@@ -153,14 +86,7 @@ nightly: { | ||
'amd', | ||
'mocha', | ||
'phantomjs' | ||
'mocha' | ||
], | ||
fix: true, | ||
globals: ['assert', 'sinon'] | ||
}, | ||
target: [src + '*.js', '<%= pkg.directories.test %>/*.js', '!<%= pkg.directories.test %>/polifills.js'] | ||
}, | ||
clean: { | ||
coverage: ['tmp-cov'], | ||
build: ['dest'] | ||
} | ||
@@ -170,27 +96,4 @@ }); | ||
grunt.registerMultiTask('prepareForCoverage', 'Generates coverage reports for JS using Istanbul', function() { | ||
var istanbul = require('istanbul'); | ||
var ignore = this.data.ignore || []; | ||
var instrumenter = new istanbul.Instrumenter(); | ||
this.files.forEach(function(file) { | ||
var filename = file.src[0]; | ||
var instrumented = grunt.file.read(filename); | ||
if (!grunt.file.isMatch(ignore, filename)) { | ||
instrumented = instrumenter.instrumentSync(instrumented, filename); | ||
} | ||
grunt.file.write(file.dest, instrumented); | ||
}); | ||
}); | ||
[ | ||
['build', ['clean:build', 'umd', 'uglify', 'template:test']], | ||
['test', ['copy:test', 'template:test', 'mocha:test']], | ||
['lint', ['eslint']], | ||
['coverage', ['prepareForCoverage', 'copy:test', 'template:coverage', 'mocha:coverage', 'clean:coverage', 'template:test']], | ||
['doc', ['jsdoc']], | ||
['gh-pages', ['copy:test', 'coverage', 'doc', 'template:gh-pages']] | ||
['build', ['umd', 'uglify']] | ||
].forEach(function(registry){ | ||
@@ -197,0 +100,0 @@ grunt.registerTask.apply(grunt, registry); |
{ | ||
"name": "@valerii-zinchenko/observer", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Simple tool to work with events.", | ||
@@ -10,6 +10,11 @@ "main": "dest/observer.js", | ||
"type": "git", | ||
"url": "git+https://github.com/valerii-zinchenko/observer.git" | ||
"url": "git+https://gitlab.com/valerii-zinchenko/observer.git" | ||
}, | ||
"scripts": { | ||
"preversion": "grunt test", | ||
"build": "grunt build", | ||
"test": "grunt copy && mocha-headless-chrome -a no-sandbox --file test/index.html --reporter spec", | ||
"lint": "grunt eslint", | ||
"doc": "grunt jsdoc", | ||
"publish-html": "npm run doc && grunt copy", | ||
"preversion": "npm run lint && npm test", | ||
"prepublishOnly": "grunt build" | ||
@@ -24,26 +29,19 @@ }, | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"eslint": "^3.7.1", | ||
"eslint-config-standard": "^6.2.0", | ||
"eslint-plugin-promise": "^3.0.0", | ||
"eslint-plugin-standard": "^2.0.1", | ||
"grunt": "^1.0.1", | ||
"grunt-contrib-clean": "^1.0.0", | ||
"grunt-contrib-copy": "^1.0.0", | ||
"grunt-contrib-uglify": "^2.0.0", | ||
"grunt-eslint": "^19.0.0", | ||
"grunt-istanbul": "^0.7.1", | ||
"grunt-jsdoc": "^2.1.0", | ||
"grunt-mocha-phantom-istanbul": "^0.2.1", | ||
"grunt-template": "^1.0.0", | ||
"grunt-umd": "^2.3.6", | ||
"istanbul": "^0.4.5", | ||
"load-grunt-tasks": "^3.5.2", | ||
"mocha": "^3.0.2", | ||
"sinon": "^1.17.5" | ||
"chai": "4.x", | ||
"eslint": "5.x", | ||
"grunt": "1.x", | ||
"grunt-contrib-copy": "1.x", | ||
"grunt-contrib-uglify": "4.x", | ||
"grunt-eslint": "21.x", | ||
"grunt-jsdoc": "2.x", | ||
"grunt-umd": "3.x", | ||
"load-grunt-tasks": "4.x", | ||
"mocha": "5.x", | ||
"mocha-headless-chrome": "2.x", | ||
"sinon": "6.x" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/valerii-zinchenko/observer/issues" | ||
"url": "https://gitlab.com/valerii-zinchenko/observer/issues" | ||
}, | ||
"homepage": "https://github.com/valerii-zinchenko/observer#readme", | ||
"homepage": "https://gitlab.com/valerii-zinchenko/observer#readme", | ||
"keywords": [ | ||
@@ -50,0 +48,0 @@ "javascript", |
@@ -111,5 +111,4 @@ # Observer | ||
- [wiki](https://github.com/valerii-zinchenko/observer/wiki) | ||
- [API](http://valerii-zinchenko.github.io/observer/doc/nightly/index.html) | ||
- [Code coverage](http://valerii-zinchenko.github.io/observer/coverage/index.html) | ||
- [Run unit tests](http://valerii-zinchenko.github.io/observer/test/index.html) | ||
- [wiki](https://gitlab.com/valerii-zinchenko/observer/wikis/home) | ||
- [API](https://valerii-zinchenko.gitlab.io/observer/doc/nightly/index.html) | ||
- [Run unit tests](https://valerii-zinchenko.gitlab.io/observer/test/index.html) |
@@ -5,4 +5,4 @@ /* | ||
* Copyright (c) 2016-2018 Valerii Zinchenko | ||
* Licensed under MIT (https://github.com/valerii-zinchenko/observer/blob/master/LICENSE.txt). | ||
* All source files are available at: http://github.com/valerii-zinchenko/observer | ||
* Licensed under MIT (https://gitlab.com/valerii-zinchenko/observer/blob/master/LICENSE.txt). | ||
* All source files are available at: http://gitlab.com/valerii-zinchenko/observer | ||
*/ | ||
@@ -9,0 +9,0 @@ |
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
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
12
1
0
22954
9
522
114