Skip to content

Commit 3bc4151

Browse files
committed
feat: added context name pattern
1 parent 0c75aa8 commit 3bc4151

File tree

3 files changed

+46
-6
lines changed

3 files changed

+46
-6
lines changed

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,46 @@ All notable changes to this project will be documented in this file.
44

55
## Unreleased
66

7+
---
8+
9+
## Released
10+
11+
### [3.8.3] - 2024-04-13
12+
13+
### Update
14+
15+
- Update core
16+
- Added support to multi context name
17+
- Details [Commit](https://github.com/4lessandrodev/rich-domain/commit/00db292f0604469c8bf2f2fddf6460901a084cc6)
18+
19+
```ts
20+
21+
// Example Usage
22+
const context = Context.events();
23+
24+
const handler = (event) => console.log(event);
25+
26+
// Subscribing to events under different contexts
27+
context.subscribe('Context-A:SIGNUP', handler);
28+
context.subscribe('Context-B:SIGNUP', handler);
29+
context.subscribe('Context-C:SIGNUP', handler);
30+
context.subscribe('Context-B:NOTIFY', handler);
31+
context.subscribe('Context-B:SEND-EMAIL', handler);
32+
33+
// Dispatching events to specific contexts
34+
// Dispatches the SIGNUP event to Context-B
35+
context.dispatchEvent('Context-B:SIGNUP');
36+
// Dispatches the SIGNUP event to all contexts
37+
context.dispatchEvent('*:SIGNUP');
38+
// Dispatches all events to all contexts. Not recommended
39+
context.dispatchEvent('*:*');
40+
// Dispatches all events under Context-B
41+
context.dispatchEvent('Context-B:*');
42+
43+
```
44+
45+
---
46+
747
### [3.8.2] - 2024-04-12
848

949
### Update

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "types-ddd",
3-
"version": "3.8.2",
3+
"version": "3.8.3",
44
"description": "This package provide utils file and interfaces to assistant build a complex application with domain driving design",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -61,7 +61,7 @@
6161
"bcrypt": "^5.0.1",
6262
"pino": "^8.17.1",
6363
"pino-pretty": "^11.0.0",
64-
"rich-domain": "^1.21.0"
64+
"rich-domain": "^1.22.0"
6565
},
6666
"devDependencies": {
6767
"@microsoft/tsdoc": "^0.14.1",

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3611,10 +3611,10 @@ rfdc@^1.3.0:
36113611
resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.0.tgz#d0b7c441ab2720d05dc4cf26e01c89631d9da08b"
36123612
integrity sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==
36133613

3614-
rich-domain@^1.21.0:
3615-
version "1.21.0"
3616-
resolved "https://registry.yarnpkg.com/rich-domain/-/rich-domain-1.21.0.tgz#5f4dd4a79c4b1776c6ee0d7d74c5d81c95c007a2"
3617-
integrity sha512-guZpUeIxxWihQR+UYKZhBlNChlAW4uzTXXFh+lBVQ0UOfX1IoSzozqvHcDjQwDB8UHdNoP2W5OD+VPB9I5KkKg==
3614+
rich-domain@^1.22.0:
3615+
version "1.22.0"
3616+
resolved "https://registry.yarnpkg.com/rich-domain/-/rich-domain-1.22.0.tgz#cc191e5600038ac37b8bc656570cd4cc93edcd60"
3617+
integrity sha512-LHCkQjc0WbUVDyRiY9bhraKvVlwqNV99aN36qo5mY2Y2B1nE9spDcLBhCaIakyJBKZk1yLhoLxn4+JivTemwBQ==
36183618

36193619
rimraf@^3.0.0, rimraf@^3.0.2:
36203620
version "3.0.2"

0 commit comments

Comments
 (0)