@peter.naydenov/notice 2.4.0 → 2.4.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peter.naydenov/notice",
3
3
  "description": "Event emmiter - NOTICE",
4
- "version": "2.4.0",
4
+ "version": "2.4.1",
5
5
  "license": "MIT",
6
6
  "author": "Peter Naydenov",
7
7
  "main": "./src/main.js",
@@ -28,14 +28,14 @@
28
28
  "url": "git+https://github.com/PeterNaydenov/notice"
29
29
  },
30
30
  "devDependencies": {
31
- "@rollup/plugin-commonjs": "^28.0.2",
32
- "@rollup/plugin-node-resolve": "^16.0.0",
31
+ "@rollup/plugin-commonjs": "^28.0.3",
32
+ "@rollup/plugin-node-resolve": "^16.0.1",
33
33
  "@rollup/plugin-terser": "^0.4.4",
34
34
  "c8": "^10.1.3",
35
- "chai": "5.1.2",
36
- "mocha": "11.0.1",
37
- "rollup": "^4.30.1",
38
- "typescript": "^5.7.3"
35
+ "chai": "5.2.0",
36
+ "mocha": "11.2.2",
37
+ "rollup": "^4.40.1",
38
+ "typescript": "^5.8.3"
39
39
  },
40
40
  "c8": {
41
41
  "include": [
package/src/main.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict"
2
2
  function notice () {
3
- function Notice () {
3
+
4
4
  let
5
5
  scroll = {'*':[]} // General events with their subscribers
6
6
  , scrollOnce = {} // Single events with their subscribers
7
- , ignore = [] // Ignore event names ( general and single )
7
+ , ignore = new Set () // Ignore event names ( general and single )
8
8
  , debugFlag = false
9
9
  , debugHeader = ''
10
10
  ;
@@ -56,7 +56,7 @@ function notice () {
56
56
  function reset () {
57
57
  scroll = {'*':[]}
58
58
  scrollOnce = {}
59
- ignore = []
59
+ ignore = new Set ()
60
60
  } // reset func.
61
61
  /**
62
62
  * Enables or disables debug mode.
@@ -92,7 +92,7 @@ function notice () {
92
92
  function exeCallback ( name ) {
93
93
  let stopped = false;
94
94
  if ( name === '*' ) return
95
- if ( ignore.includes(name) ) return
95
+ if ( ignore.has(name) ) return
96
96
  scroll[name].every ( fn => {
97
97
  const r = fn ( ...args );
98
98
  if ( typeof(r) !== 'string' ) return true
@@ -111,7 +111,7 @@ function notice () {
111
111
  return
112
112
  }
113
113
  if ( scrollOnce[e] ) {
114
- if ( ignore.includes(e) ) return
114
+ if ( ignore.has(e) ) return
115
115
  scrollOnce[e].forEach ( fn => fn(...args) )
116
116
  delete scrollOnce[e]
117
117
  }
@@ -127,10 +127,10 @@ function notice () {
127
127
  */
128
128
  function start ( e ) {
129
129
  if ( e === '*' ) {
130
- ignore = []
130
+ ignore.clear ()
131
131
  return
132
132
  }
133
- ignore = ignore.filter ( type => e != type )
133
+ ignore.delete ( e )
134
134
  } // start func.
135
135
  /**
136
136
  * Temporarily disables specified event.
@@ -144,10 +144,10 @@ function notice () {
144
144
  evNames = Object.keys ( scroll )
145
145
  , evOnceNames = Object.keys ( scrollOnce )
146
146
  ;
147
- ignore = [ ...evOnceNames, ...evNames ]
147
+ ignore = new Set ([ ...evOnceNames, ...evNames ])
148
148
  return
149
149
  }
150
- ignore.push ( e )
150
+ ignore.add ( e )
151
151
  } // stop func.
152
152
 
153
153
  return {
@@ -160,9 +160,7 @@ function notice () {
160
160
  , start // Remove event from ignore list
161
161
  , debug
162
162
  }
163
- } // notice fn.
164
- return Notice ()
165
- }
163
+ } // notice func.
166
164
 
167
165
 
168
166
 
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":";AACA;YAWgC,MAAM,GAAC,MAAM;cAWd,MAAM,GAAC,MAAM;aAcb,MAAM,GAAC,MAAM;;;cAoGb,MAAM,GAAC,MAAM;eAbb,MAAM,GAAC,MAAM;iBA5DZ,OAAO,WACP,MAAM;EAmGrC"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":";AACA;YAWgC,MAAM,GAAC,MAAM;cAWd,MAAM,GAAC,MAAM;aAcb,MAAM,GAAC,MAAM;;;cAoGb,MAAM,GAAC,MAAM;eAbb,MAAM,GAAC,MAAM;iBA5DZ,OAAO,WACP,MAAM;EAiGrC"}