Skip to content

Commit

Permalink
update changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
cevr committed Jan 15, 2024
1 parent 5c94a82 commit d9bd505
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions .changeset/tasty-baboons-dance.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,28 @@
---

added support for `actor.system.subscribe` to subscribe to registration and unregistration events within an actor's system.
`actor.system.subscribe` returns a `Subscription` object you can `.unsubscribe` to at any time.

you can use `actor.system.subscribe` in two ways:
ex:

- `actor.system.subscribe(event => ...)` subscribes to all registration/unregistration events occurring within the system
- `actor.system.subscribe(systemId, event => ...)` subscribes to the registration/unregistration events of that given systemId.
```js
// observer object
const subscription = actor.system.subscribe({
next: (event) => console.log(event),
error: (err) => console.error(err),
complete: () => console.log('done')
});

`actor.system.subscribe` returns a `Subscription` object you can `.unsubscribe` to at any time.
// observer parameters
const subscription = actor.system.subscribe(
(event) => console.log(event),
(err) => console.error(err),
() => console.log('done')
);

// callback function
const subscription = actor.system.subscribe((event) => console.log(event));

// unsubscribe
subscription.unsubscribe();
```

0 comments on commit d9bd505

Please sign in to comment.