zephyr-events 1.1.0 â 1.1.2
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 +35 -26
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,11 +6,9 @@ Ultra-fast ES2023 event emitter with **905B** bundle size and race-condition saf
|
|
|
6
6
|
[](https://bundlephobia.com/package/zephyr-events)
|
|
7
7
|
[](https://www.typescriptlang.org/)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
**Zephyr Events** is a **heavy modernization and performance upgrade** of the original [mitt](https://github.com/developit/mitt) package by [Jason Miller](https://github.com/developit). Thanks for the foundational work! ð
|
|
9
|
+
---
|
|
12
10
|
|
|
13
|
-
## ⥠Features
|
|
11
|
+
## ⥠Key Features
|
|
14
12
|
|
|
15
13
|
- **ðĨ Ultra Fast**: 33M+ operations/second with native Set/Map optimizations
|
|
16
14
|
- **ðŠķ Tiny Bundle**: Only 905B minified, 0 dependencies
|
|
@@ -19,12 +17,16 @@ Ultra-fast ES2023 event emitter with **905B** bundle size and race-condition saf
|
|
|
19
17
|
- **ðĶ Tree Shakeable**: ES modules with proper exports
|
|
20
18
|
- **ð§ TypeScript**: Full type safety with generics and strict types
|
|
21
19
|
|
|
20
|
+
---
|
|
21
|
+
|
|
22
22
|
## ðĨ Installation
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
npm install zephyr-events
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
---
|
|
29
|
+
|
|
28
30
|
## ð Quick Start
|
|
29
31
|
|
|
30
32
|
```typescript
|
|
@@ -50,7 +52,9 @@ emitter.emit('user', { id: 1, name: 'Alice' });
|
|
|
50
52
|
unsubscribe();
|
|
51
53
|
```
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## ðĻ API Reference
|
|
54
58
|
|
|
55
59
|
### `zephyrEvents<Events>()`
|
|
56
60
|
|
|
@@ -99,7 +103,11 @@ emitter.emit('message', 'Hello World!');
|
|
|
99
103
|
emitter.emit('data', { value: 42 });
|
|
100
104
|
```
|
|
101
105
|
|
|
102
|
-
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## ðïļ Technical Details
|
|
109
|
+
|
|
110
|
+
### Architecture
|
|
103
111
|
|
|
104
112
|
Zephyr Events uses a **dual-storage architecture** for maximum performance:
|
|
105
113
|
|
|
@@ -107,14 +115,7 @@ Zephyr Events uses a **dual-storage architecture** for maximum performance:
|
|
|
107
115
|
- **Array snapshots**: Fast iteration with race-condition safety
|
|
108
116
|
- **ES2023 optimizations**: Native optional chaining and nullish coalescing
|
|
109
117
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
```typescript
|
|
113
|
-
// Benchmark: Comprehensive performance testing
|
|
114
|
-
// Result: Up to 33M+ operations/second
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
## ð Race-Condition Safety
|
|
118
|
+
### Race-Condition Safety
|
|
118
119
|
|
|
119
120
|
Handlers are executed from immutable snapshots:
|
|
120
121
|
|
|
@@ -124,18 +125,20 @@ emitter.on('test', function selfRemover() {
|
|
|
124
125
|
});
|
|
125
126
|
```
|
|
126
127
|
|
|
127
|
-
|
|
128
|
+
### ES2023 Features
|
|
128
129
|
|
|
129
130
|
- **Nullish coalescing**: `all ??= new Map()`
|
|
130
131
|
- **Optional chaining**: `handlers?.size`
|
|
131
132
|
- **Spread operators**: `[...handlers]` for fast snapshots
|
|
132
133
|
|
|
133
|
-
|
|
134
|
+
### Bundle Formats
|
|
134
135
|
|
|
135
136
|
- **ESM**: `dist/zephyr-events.mjs` (905B)
|
|
136
137
|
- **CommonJS**: `dist/zephyr-events.js` (977B)
|
|
137
138
|
- **UMD**: `dist/zephyr-events.umd.js` (1.3KB)
|
|
138
139
|
|
|
140
|
+
---
|
|
141
|
+
|
|
139
142
|
## ð Comparison
|
|
140
143
|
|
|
141
144
|
| Feature | Zephyr Events | mitt* | eventemitter3 |
|
|
@@ -148,15 +151,7 @@ emitter.on('test', function selfRemover() {
|
|
|
148
151
|
|
|
149
152
|
*\*Based on original mitt package by Jason Miller*
|
|
150
153
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
Contributions welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
154
|
-
|
|
155
|
-
## ð License
|
|
156
|
-
|
|
157
|
-
MIT ÂĐ [ebogdum](https://github.com/ebogdum)
|
|
158
|
-
|
|
159
|
-
Original mitt: MIT ÂĐ [Jason Miller](https://github.com/developit)
|
|
154
|
+
---
|
|
160
155
|
|
|
161
156
|
## ð Performance Benchmarks
|
|
162
157
|
|
|
@@ -199,4 +194,18 @@ Comprehensive performance benchmarks on **Apple Silicon M-series (ARM64)** with
|
|
|
199
194
|
|
|
200
195
|
---
|
|
201
196
|
|
|
202
|
-
|
|
197
|
+
## ð Acknowledgments
|
|
198
|
+
|
|
199
|
+
**Zephyr Events** is a heavy modernization and performance upgrade of the original [mitt](https://github.com/developit/mitt) package by [Jason Miller](https://github.com/developit). Thanks for the foundational work!
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## ðĪ Contributing
|
|
204
|
+
|
|
205
|
+
Contributions welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
206
|
+
|
|
207
|
+
## ð License
|
|
208
|
+
|
|
209
|
+
MIT ÂĐ [ebogdum](https://github.com/ebogdum)
|
|
210
|
+
|
|
211
|
+
Original mitt: MIT ÂĐ [Jason Miller](https://github.com/developit)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zephyr-events",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Ultra-fast ES2023 event emitter with 889B bundle size and race-condition safety",
|
|
5
5
|
"main": "dist/zephyr-events.js",
|
|
6
6
|
"module": "dist/zephyr-events.mjs",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
|
-
"url": "https://github.com/ebogdum/zephyr-events.git"
|
|
26
|
+
"url": "git+https://github.com/ebogdum/zephyr-events.git"
|
|
27
27
|
},
|
|
28
28
|
"keywords": [
|
|
29
29
|
"events",
|