@peter.naydenov/notice 2.2.3 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/notice.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";module.exports=function(){return new function(){let e={"*":[]},t={},n=[],o=!1,c="";return{on:function(t,n){e[t]||(e[t]=[]),e[t].push(n)},once:function(e,n){"*"!==e&&(t[e]||(t[e]=[]),t[e].push(n))},off:function(n,o){if(o)return e[n]&&(e[n]=e[n].filter((e=>e!==o))),t[n]&&(t[n]=t[n].filter((e=>e!==o))),e[n]&&0===e[n].length&&delete e[n],void(t[n]&&0===t[n].length&&delete e[n]);t[n]&&delete t[n],e[n]&&delete e[n]},reset:function(){e={"*":[]},t={},n=[]},emit:function(){const[f,...i]=arguments;function l(t){"*"!==t&&(n.includes(t)||(e[t].forEach((e=>e(...i))),e["*"].forEach((e=>e(f,...i)))))}if(o&&(console.log(`${c} Event "${f}" was triggered.`),i.length>0&&(console.log("Arguments:"),console.log(...i),console.log("^----"))),"*"!==f){if(t[f]){if(n.includes(f))return;t[f].forEach((e=>e(...i))),delete t[f]}e[f]&&l(f)}else{Object.keys(e).forEach((e=>l(e)))}},stop:function(o){if("*"!==o)n.push(o);else{const o=Object.keys(e),c=Object.keys(t);n=[...c,...o]}},start:function(e){n="*"!==e?n.filter((t=>e!=t)):[]},debug:function(e,t){o=!!e,t&&"string"==typeof t&&(c=t)}}}};
1
+ "use strict";module.exports=function(){return new function(){let e={"*":[]},t={},n=[],o=!1,c="";return{on:function(t,n){e[t]||(e[t]=[]),e[t].push(n)},once:function(e,n){"*"!==e&&(t[e]||(t[e]=[]),t[e].push(n))},off:function(n,o){if(o)return e[n]&&(e[n]=e[n].filter((e=>e!==o))),t[n]&&(t[n]=t[n].filter((e=>e!==o))),e[n]&&0===e[n].length&&delete e[n],void(t[n]&&0===t[n].length&&delete e[n]);t[n]&&delete t[n],e[n]&&delete e[n]},reset:function(){e={"*":[]},t={},n=[]},emit:function(){const[s,...i]=arguments;function r(t){"*"!==t&&(n.includes(t)||(e[t].every((e=>{const t=e(...i);return"string"!=typeof t||"STOP"!==t.toUpperCase()})),e["*"].forEach((e=>e(s,...i)))))}if(o&&(console.log(`${c} Event "${s}" was triggered.`),i.length>0&&(console.log("Arguments:"),console.log(...i),console.log("^----"))),"*"!==s){if(t[s]){if(n.includes(s))return;t[s].forEach((e=>e(...i))),delete t[s]}e[s]&&r(s)}else{Object.keys(e).forEach((e=>r(e)))}},stop:function(o){if("*"!==o)n.push(o);else{const o=Object.keys(e),c=Object.keys(t);n=[...c,...o]}},start:function(e){n="*"!==e?n.filter((t=>e!=t)):[]},debug:function(e,t){o=!!e,t&&"string"==typeof t&&(c=t)}}}};
@@ -1 +1 @@
1
- function e(){return new function(){let e={"*":[]},t={},n=[],o=!1,c="";return{on:function(t,n){e[t]||(e[t]=[]),e[t].push(n)},once:function(e,n){"*"!==e&&(t[e]||(t[e]=[]),t[e].push(n))},off:function(n,o){if(o)return e[n]&&(e[n]=e[n].filter((e=>e!==o))),t[n]&&(t[n]=t[n].filter((e=>e!==o))),e[n]&&0===e[n].length&&delete e[n],void(t[n]&&0===t[n].length&&delete e[n]);t[n]&&delete t[n],e[n]&&delete e[n]},reset:function(){e={"*":[]},t={},n=[]},emit:function(){const[f,...i]=arguments;function l(t){"*"!==t&&(n.includes(t)||(e[t].forEach((e=>e(...i))),e["*"].forEach((e=>e(f,...i)))))}if(o&&(console.log(`${c} Event "${f}" was triggered.`),i.length>0&&(console.log("Arguments:"),console.log(...i),console.log("^----"))),"*"!==f){if(t[f]){if(n.includes(f))return;t[f].forEach((e=>e(...i))),delete t[f]}e[f]&&l(f)}else{Object.keys(e).forEach((e=>l(e)))}},stop:function(o){if("*"!==o)n.push(o);else{const o=Object.keys(e),c=Object.keys(t);n=[...c,...o]}},start:function(e){n="*"!==e?n.filter((t=>e!=t)):[]},debug:function(e,t){o=!!e,t&&"string"==typeof t&&(c=t)}}}}export{e as default};
1
+ function e(){return new function(){let e={"*":[]},t={},n=[],o=!1,c="";return{on:function(t,n){e[t]||(e[t]=[]),e[t].push(n)},once:function(e,n){"*"!==e&&(t[e]||(t[e]=[]),t[e].push(n))},off:function(n,o){if(o)return e[n]&&(e[n]=e[n].filter((e=>e!==o))),t[n]&&(t[n]=t[n].filter((e=>e!==o))),e[n]&&0===e[n].length&&delete e[n],void(t[n]&&0===t[n].length&&delete e[n]);t[n]&&delete t[n],e[n]&&delete e[n]},reset:function(){e={"*":[]},t={},n=[]},emit:function(){const[f,...i]=arguments;function r(t){"*"!==t&&(n.includes(t)||(e[t].every((e=>{const t=e(...i);return"string"!=typeof t||"STOP"!==t.toUpperCase()})),e["*"].forEach((e=>e(f,...i)))))}if(o&&(console.log(`${c} Event "${f}" was triggered.`),i.length>0&&(console.log("Arguments:"),console.log(...i),console.log("^----"))),"*"!==f){if(t[f]){if(n.includes(f))return;t[f].forEach((e=>e(...i))),delete t[f]}e[f]&&r(f)}else{Object.keys(e).forEach((e=>r(e)))}},stop:function(o){if("*"!==o)n.push(o);else{const o=Object.keys(e),c=Object.keys(t);n=[...c,...o]}},start:function(e){n="*"!==e?n.filter((t=>e!=t)):[]},debug:function(e,t){o=!!e,t&&"string"==typeof t&&(c=t)}}}}export{e as default};
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).notice=n()}(this,(function(){"use strict";return function(){return new function(){let e={"*":[]},n={},t=[],o=!1,f="";return{on:function(n,t){e[n]||(e[n]=[]),e[n].push(t)},once:function(e,t){"*"!==e&&(n[e]||(n[e]=[]),n[e].push(t))},off:function(t,o){if(o)return e[t]&&(e[t]=e[t].filter((e=>e!==o))),n[t]&&(n[t]=n[t].filter((e=>e!==o))),e[t]&&0===e[t].length&&delete e[t],void(n[t]&&0===n[t].length&&delete e[t]);n[t]&&delete n[t],e[t]&&delete e[t]},reset:function(){e={"*":[]},n={},t=[]},emit:function(){const[i,...c]=arguments;function l(n){"*"!==n&&(t.includes(n)||(e[n].forEach((e=>e(...c))),e["*"].forEach((e=>e(i,...c)))))}if(o&&(console.log(`${f} Event "${i}" was triggered.`),c.length>0&&(console.log("Arguments:"),console.log(...c),console.log("^----"))),"*"!==i){if(n[i]){if(t.includes(i))return;n[i].forEach((e=>e(...c))),delete n[i]}e[i]&&l(i)}else{Object.keys(e).forEach((e=>l(e)))}},stop:function(o){if("*"!==o)t.push(o);else{const o=Object.keys(e),f=Object.keys(n);t=[...f,...o]}},start:function(e){t="*"!==e?t.filter((n=>e!=n)):[]},debug:function(e,n){o=!!e,n&&"string"==typeof n&&(f=n)}}}}}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).notice=t()}(this,(function(){"use strict";return function(){return new function(){let e={"*":[]},t={},n=[],o=!1,f="";return{on:function(t,n){e[t]||(e[t]=[]),e[t].push(n)},once:function(e,n){"*"!==e&&(t[e]||(t[e]=[]),t[e].push(n))},off:function(n,o){if(o)return e[n]&&(e[n]=e[n].filter((e=>e!==o))),t[n]&&(t[n]=t[n].filter((e=>e!==o))),e[n]&&0===e[n].length&&delete e[n],void(t[n]&&0===t[n].length&&delete e[n]);t[n]&&delete t[n],e[n]&&delete e[n]},reset:function(){e={"*":[]},t={},n=[]},emit:function(){const[i,...c]=arguments;function s(t){"*"!==t&&(n.includes(t)||(e[t].every((e=>{const t=e(...c);return"string"!=typeof t||"STOP"!==t.toUpperCase()})),e["*"].forEach((e=>e(i,...c)))))}if(o&&(console.log(`${f} Event "${i}" was triggered.`),c.length>0&&(console.log("Arguments:"),console.log(...c),console.log("^----"))),"*"!==i){if(t[i]){if(n.includes(i))return;t[i].forEach((e=>e(...c))),delete t[i]}e[i]&&s(i)}else{Object.keys(e).forEach((e=>s(e)))}},stop:function(o){if("*"!==o)n.push(o);else{const o=Object.keys(e),f=Object.keys(t);n=[...f,...o]}},start:function(e){n="*"!==e?n.filter((t=>e!=t)):[]},debug:function(e,t){o=!!e,t&&"string"==typeof t&&(f=t)}}}}}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peter.naydenov/notice",
3
3
  "description": "Event emmiter - NOTICE",
4
- "version": "2.2.3",
4
+ "version": "2.3.0",
5
5
  "license": "MIT",
6
6
  "author": "Peter Naydenov",
7
7
  "main": "./dist/notice.umd.js",
@@ -30,9 +30,9 @@
30
30
  "@rollup/plugin-node-resolve": "^15.2.3",
31
31
  "@rollup/plugin-terser": "^0.4.4",
32
32
  "c8": "^9.1.0",
33
- "chai": "5.0.3",
34
- "mocha": "10.2.0",
35
- "rollup": "^4.9.6"
33
+ "chai": "5.1.0",
34
+ "mocha": "10.3.0",
35
+ "rollup": "^4.13.0"
36
36
  },
37
37
  "c8": {
38
38
  "include": [
package/src/main.js CHANGED
@@ -52,7 +52,12 @@ function notice () {
52
52
  function exeCallback ( name ) {
53
53
  if ( name === '*' ) return
54
54
  if ( ignore.includes(name) ) return
55
- scroll[name].forEach ( fn => fn(...args))
55
+ scroll[name].every ( fn => {
56
+ const r = fn ( ...args );
57
+ if ( typeof(r) !== 'string' ) return true
58
+ if ( r.toUpperCase() === 'STOP' ) return false
59
+ return true
60
+ })
56
61
  scroll['*'].forEach ( fn => fn(e,...args) )
57
62
  } // exeCallback func.
58
63