@zeltjs/eventbus 0.4.0 → 0.5.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/README.md +33 -0
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @zeltjs/eventbus
|
|
2
|
+
|
|
3
|
+
[](https://zeltjs.com)
|
|
4
|
+
|
|
5
|
+
Event bus abstraction for Zelt applications.
|
|
6
|
+
|
|
7
|
+
**[Read the Documentation](https://zeltjs.com)**
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @zeltjs/eventbus @zeltjs/core
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { MemoryEventBusAdaptor } from '@zeltjs/eventbus';
|
|
19
|
+
import type { EventBusSchema } from '@zeltjs/eventbus';
|
|
20
|
+
|
|
21
|
+
type MyEvents = EventBusSchema<{
|
|
22
|
+
'user.created': { id: string; name: string };
|
|
23
|
+
'user.deleted': { id: string };
|
|
24
|
+
}>;
|
|
25
|
+
|
|
26
|
+
const eventbus = new MemoryEventBusAdaptor<MyEvents>();
|
|
27
|
+
|
|
28
|
+
eventbus.on('user.created', (data) => {
|
|
29
|
+
console.log('User created:', data.name);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
eventbus.emit('user.created', { id: '1', name: 'Alice' });
|
|
33
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeltjs/eventbus",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@zeltjs/core": "0.
|
|
33
|
-
"@zeltjs/redis": "0.
|
|
32
|
+
"@zeltjs/core": "0.5.0",
|
|
33
|
+
"@zeltjs/redis": "0.5.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependenciesMeta": {
|
|
36
36
|
"@zeltjs/redis": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "22.19.17",
|
|
42
42
|
"ioredis": "5.10.1",
|
|
43
|
-
"@zeltjs/core": "0.
|
|
44
|
-
"@zeltjs/redis": "0.
|
|
43
|
+
"@zeltjs/core": "0.5.0",
|
|
44
|
+
"@zeltjs/redis": "0.5.0"
|
|
45
45
|
},
|
|
46
46
|
"volta": {
|
|
47
47
|
"extends": "../../package.json"
|