Minor Changes
-
#4936
c58b36dc3
Thanks @davidkpiano! - Inspecting an actor system viaactor.system.inspect(ev => …)
now accepts a function or observer, and returns a subscription:const actor = createActor(someMachine); const sub = actor.system.inspect((inspectionEvent) => { console.log(inspectionEvent); }); // Inspection events will be logged actor.start(); actor.send({ type: 'anEvent' }); // ... sub.unsubscribe(); // Will no longer log inspection events actor.send({ type: 'someEvent' });
-
#4942
9caaa1f70
Thanks @boneskull! -DoneActorEvent
andErrorActorEvent
now contain propertyactorId
, which refers to the ID of the actor the event refers to. -
#4935
2ac08b700
Thanks @davidkpiano! - All actor logic creators now support emitting events:Promise actors
const logic = fromPromise(async ({ emit }) => { // ... emit({ type: 'emitted', msg: 'hello' }); // ... });
Transition actors
const logic = fromTransition((state, event, { emit }) => { // ... emit({ type: 'emitted', msg: 'hello' }); // ... return state; }, {});
Observable actors
const logic = fromObservable(({ emit }) => { // ... emit({ type: 'emitted', msg: 'hello' }); // ... });
Callback actors
const logic = fromCallback(({ emit }) => { // ... emit({ type: 'emitted', msg: 'hello' }); // ... });
Patch Changes
- #4929
417f35a11
Thanks @boneskull! - Expose typeUnknownActorRef
for use when callinggetSnapshot()
on an unknownActorRef
.