From 984bdfabb5abe44e048aa5be5d61a477c87f97be Mon Sep 17 00:00:00 2001 From: David Khourshid Date: Sat, 23 Dec 2023 10:24:23 -0500 Subject: [PATCH] Add changeset --- .changeset/famous-dingos-tease.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .changeset/famous-dingos-tease.md diff --git a/.changeset/famous-dingos-tease.md b/.changeset/famous-dingos-tease.md new file mode 100644 index 0000000000..85b580366b --- /dev/null +++ b/.changeset/famous-dingos-tease.md @@ -0,0 +1,23 @@ +--- +'xstate': minor +--- + +An actor being stopped can now be observed: + +```ts +const actor = createActor(machine); + +actor.subscribe({ + next: (snapshot) => { + if (snapshot.status === 'stopped') { + console.log('Actor stopped'); + } + } +}); + +actor.start(); + +// ... + +actor.stop(); +```