-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8276156
commit 64523d8
Showing
1 changed file
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
'@xstate/store': minor | ||
--- | ||
|
||
The store now extends EventTarget, allowing for native DOM event handling capabilities while maintaining the existing `.on()` API. This change: | ||
|
||
- Adds support for standard `.addEventListener(…)` and `.removeEventListener(…)` methods | ||
- Simplifies internal event handling by leveraging native `EventTarget` functionality | ||
- Maintains full backwards compatibility with existing `.on(…)` method | ||
|
||
```ts | ||
// ... | ||
store.addEventListener('incremented', (event) => { | ||
console.log(event.detail); | ||
}); | ||
``` |