@stacksjs/events 0.70.23 → 0.70.26
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/README.md +1 -1
- package/dist/index.js +1 -1
- package/package.json +19 -5
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ listen('foo', onFoo) // listen
|
|
|
35
35
|
off('foo', onFoo) // unlisten
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
To view the full documentation, please visit [https://stacksjs.
|
|
38
|
+
To view the full documentation, please visit [<https://stacksjs.com/event>s](https://stacksjs.com/events).
|
|
39
39
|
|
|
40
40
|
## 🧪 Testing
|
|
41
41
|
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function
|
|
2
|
+
var W=Symbol.for("stacks.events.handler.error");function X($,B,M){console.error(`[Events] ${$} for '${String(B)}':`,M)}function D($){return!!$&&typeof $.catch==="function"}function G($){let B=$??new Map,M=new Map,K=(j,z)=>{let q=M.get(j);if(!q)q=new RegExp(`^${j.replace(/\*/g,".*")}$`),M.set(j,q);return q.test(z)};function R(j,z){let q=B.get(j);if(q)q.push(z);else B.set(j,[z])}function b(j,z){let q=(...J)=>{return T(j,q),z(...J)};q[W]=z,R(j,q)}function T(j,z){let q=B.get(j);if(!q)return;if(!z){B.set(j,[]);return}for(let J=q.length-1;J>=0;J--){let U=q[J];if(U===z||U?.[W]===z)q.splice(J,1)}}function x(j){if(j===void 0)B.clear();else B.delete(j)}function N(j){return B.get(j)?.length??0}function _(j,z){let q=B.get(j)?.slice(),J=B.get("*")?.slice();if(q)for(let V of q)try{let F=V(z);if(D(F))F.catch((I)=>X("Async handler error",j,I))}catch(F){X("Handler error",j,F)}let U=String(j);if(B.forEach((V,F)=>{let I=String(F);if(I===U||I==="*"||!I.includes("*"))return;if(K(I,U))for(let O of V.slice())try{let Q=O(j,z);if(D(Q))Q.catch((P)=>X(`Async pattern handler '${I}' error`,j,P))}catch(Q){X(`Pattern handler '${I}' error`,j,Q)}}),J)for(let V of J)try{let F=V(j,z);if(D(F))F.catch((I)=>X("Async wildcard handler error",j,I))}catch(F){X("Wildcard handler error",j,F)}}async function C(j,z){let q=[],J=async(F,I)=>{if(!F)return;for(let O of F.slice())try{let Q=I?O(j,z):O(z);q.push(D(Q)?await Q:Q)}catch(Q){X("Awaited handler error",j,Q),q.push(void 0)}};await J(B.get(j),!1);let U=String(j),V=[];B.forEach((F,I)=>{let O=String(I);if(O===U||O==="*"||!O.includes("*"))return;if(K(O,U))V.push(O)});for(let F of V)await J(B.get(F),!0);return await J(B.get("*"),!0),q}return{all:B,on:R,once:b,off:T,emit:_,emitAsync:C,removeAllListeners:x,listenerCount:N}}var w=G,c=G,Y=G(),Z=Y,H=Y,f=Z.emit,g=Z.emitAsync,L=f,E=Z.all,S=Z.on,A=Z.on,u=Z.once,k=Z.off;export{A as useListen,H as useEvents,L as useEvent,u as once,k as off,w as mitt,S as listen,Y as events,Z as emitter,g as dispatchAsync,f as dispatch,c as default,G as createEmitter,E as all};
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/events",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.70.
|
|
4
|
+
"version": "0.70.26",
|
|
5
5
|
"description": "Functional event emitting.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
|
-
"contributors": [
|
|
7
|
+
"contributors": [
|
|
8
|
+
"Chris Breuer <chris@stacksjs.com>"
|
|
9
|
+
],
|
|
8
10
|
"license": "MIT",
|
|
9
11
|
"funding": "https://github.com/sponsors/chrisbbreuer",
|
|
10
12
|
"homepage": "https://github.com/stacksjs/stacks/tree/main/storage/framework/core/events#readme",
|
|
@@ -16,18 +18,30 @@
|
|
|
16
18
|
"bugs": {
|
|
17
19
|
"url": "https://github.com/stacksjs/stacks/issues"
|
|
18
20
|
},
|
|
19
|
-
"keywords": [
|
|
21
|
+
"keywords": [
|
|
22
|
+
"events",
|
|
23
|
+
"functional",
|
|
24
|
+
"functions",
|
|
25
|
+
"mitt",
|
|
26
|
+
"stacks"
|
|
27
|
+
],
|
|
20
28
|
"exports": {
|
|
21
29
|
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"bun": "./src/index.ts",
|
|
22
32
|
"import": "./dist/index.js"
|
|
23
33
|
},
|
|
24
34
|
"./*": {
|
|
35
|
+
"bun": "./src/*",
|
|
25
36
|
"import": "./dist/*"
|
|
26
37
|
}
|
|
27
38
|
},
|
|
28
39
|
"module": "dist/index.js",
|
|
29
40
|
"types": "dist/index.d.ts",
|
|
30
|
-
"files": [
|
|
41
|
+
"files": [
|
|
42
|
+
"README.md",
|
|
43
|
+
"dist"
|
|
44
|
+
],
|
|
31
45
|
"scripts": {
|
|
32
46
|
"build": "bun build.ts",
|
|
33
47
|
"typecheck": "bun tsc --noEmit",
|
|
@@ -35,6 +49,6 @@
|
|
|
35
49
|
"prepublishOnly": "bun run build"
|
|
36
50
|
},
|
|
37
51
|
"devDependencies": {
|
|
38
|
-
"
|
|
52
|
+
"better-dx": "^0.2.12"
|
|
39
53
|
}
|
|
40
54
|
}
|