jsevents-js
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -174,9 +174,9 @@ /** | ||
/** | ||
* @name getRegisteredEvents | ||
* @static | ||
* @method | ||
* @memberOf JSEvents | ||
* @description this function return all the events registered in the store | ||
* @returns {object} this getter will return all the registered events | ||
*/ | ||
* @name getRegisteredEvents | ||
* @static | ||
* @method | ||
* @memberOf JSEvents | ||
* @description this function return all the events registered in the store | ||
* @returns {object} this getter will return all the registered events | ||
*/ | ||
JSEvents.getRegisteredEvents = function () { | ||
@@ -183,0 +183,0 @@ return JSEvents.events; |
@@ -1,1 +0,1 @@ | ||
var JSEvents=function(){function e(){}return e.addEventListener=function(n,t,r){if(!n)throw new Error("An Event must have a valid name");if(!t)throw new Error("An Event must have a valid callback function");if(!r)throw new Error("An Event must have a valid scope");for(var a=[],v=0;v<arguments.length;v++)a.push(arguments[v]);e.events[n]?e.events[n].push({scope:r,callback:t,args:a}):e.events[n]=[{scope:r,callback:t,args:a}]},e.removeEventListener=function(n,t,r){if(!n)throw new Error("An Event must have a valid name inorder to remove it");if(!t)throw new Error("An Event must have a valid callback function to remove it");if(!r)throw new Error("An Event must have a valid scope");if(e.events[n]){var a=[];a=e.events[n].filter(function(e){return!(e.scope===r&&e.callback===t)}),e.events[n]=a,0===e.events[n].length&&delete e.events[n]}},e.hasEventListener=function(n,t,r){if(!n)throw new Error("An Event must have a valid name");if(!t)throw new Error("An Event must have a valid callback function");if(e.events[n]){if(0===e.events[n].length)return!1;for(var a=!1,v=0,o=e.events[n];v<o.length;v++){var s=o[v];if(s.scope===r&&s.callback===t){a=!0;break}}return!0===a}return!1},e.dispatchEvent=function(n,t){for(var r=[],a=0;a<arguments.length;a++)r.push(arguments[a]);r.splice(0,1);var v={data:r,name:n,target:null};if(!n)throw new Error("An Event must have a valid name");if(e.events[n]){if(e.events[n].length>0)for(var o=e.events[n],s=0,i=o;s<i.length;s++){var l=i[s];v.target=l.scope;var c=[v].concat(r);l.callback&&"function"==typeof l.callback&&l.callback.apply(v,c)}}else console.warn("No event with name "+n+" exists in the JSEvents store")},e.getRegisteredEvents=function(){return e.events},e.events={},e}();"undefined"!=typeof module&&void 0!==module.exports?module.exports=JSEvents:"function"==typeof define&&define.amd?define([],function(){return JSEvents}):window.JSEvents=JSEvents; | ||
var JSEvents=function(){function e(){}return e.addEventListener=function(n,t,r){if(!n)throw new Error("An Event must have a valid name");if(!t)throw new Error("An Event must have a valid callback function");if(!r)throw new Error("An Event must have a valid scope");for(var a=[],v=0;v<arguments.length;v++)a.push(arguments[v]);e.events[n]?e.events[n].push({scope:r,callback:t,args:a}):e.events[n]=[{scope:r,callback:t,args:a}]},e.removeEventListener=function(n,t,r){if(!n)throw new Error("An Event must have a valid name inorder to remove it");if(!t)throw new Error("An Event must have a valid callback function to remove it");if(!r)throw new Error("An Event must have a valid scope");if(e.events[n]){var a=[];a=e.events[n].filter(function(e){return!(e.scope===r&&e.callback===t)}),e.events[n]=a,0===e.events[n].length&&delete e.events[n]}},e.hasEventListener=function(n,t,r){if(!n)throw new Error("An Event must have a valid name");if(!t)throw new Error("An Event must have a valid callback function");if(e.events[n]){if(0===e.events[n].length)return!1;for(var a=!1,v=0,o=e.events[n];v<o.length;v++){var s=o[v];if(s.scope===r&&s.callback===t){a=!0;break}}return!0===a}return!1},e.dispatchEvent=function(n,t){for(var r=[],a=0;a<arguments.length;a++)r.push(arguments[a]);r.splice(0,1);var v={data:r,name:n,target:null};if(!n)throw new Error("An Event must have a valid name");if(e.events[n]){if(e.events[n].length>0)for(var o=0,s=e.events[n];o<s.length;o++){var i=s[o];v.target=i.scope;var l=[v].concat(r);i.callback&&"function"==typeof i.callback&&i.callback.apply(v,l)}}else console.warn("No event with name "+n+" exists in the JSEvents store")},e.getRegisteredEvents=function(){return e.events},e.events={},e}();"undefined"!=typeof module&&void 0!==module.exports?module.exports=JSEvents:"function"==typeof define&&define.amd?define([],function(){return JSEvents}):window.JSEvents=JSEvents; |
{ | ||
"name": "jsevents-js", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "a small javascript library to create custom events", | ||
@@ -8,5 +8,6 @@ "main": "dist/JSEvents.js", | ||
"start": "tsc ./src/JSEvents.ts --watch --outDir dist && lint:watch && uglify", | ||
"uglify":"uglifyjs ./dist/JSEvents.js --compress --mangle --output ./dist/JSEvents.min.js", | ||
"uglify": "uglifyjs ./dist/JSEvents.js --compress --mangle --output ./dist/JSEvents.min.js", | ||
"lint": " esw src --color", | ||
"lint:watch": "npm run lint --watch" | ||
"lint:watch": "npm run lint --watch", | ||
"test": "jest" | ||
}, | ||
@@ -32,4 +33,23 @@ "repository": { | ||
"devDependencies": { | ||
"typescript": "^2.6.2" | ||
} | ||
"ts-node": "^4.1.0", | ||
"typescript": "^2.6.2", | ||
"ts-jest": "^22.0.1" | ||
}, | ||
"jest": { | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js" | ||
], | ||
"transform": { | ||
"\\.(ts|tsx)$": "<rootDir>/node_modules/ts-jest/preprocessor.js" | ||
}, | ||
"testRegex": "/__tests__/.*\\.(ts|tsx|js)$" | ||
}, | ||
"collectCoverage": true, | ||
"coverageReporters": [ | ||
"json", | ||
"lcov", | ||
"text" | ||
] | ||
} |
@@ -185,3 +185,3 @@ type ICallback = ( evData: object, args: any ) => void; | ||
} | ||
/** | ||
/** | ||
* @name getRegisteredEvents | ||
@@ -188,0 +188,0 @@ * @static |
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
103357
11
521
3