Yes, onDone and onError are properties of XState. They are handling the events of whatever you are invoking. When invoking a promise, the only two events you can have are fulfilled or rejected.
With a normal event, you also specify a target and actions.
Yes,
onDone
andonError
are properties of XState. They are handling the events of whatever you are invoking. When invoking a promise, the only two events you can have are fulfilled or rejected.With a normal event, you also specify a target and actions.
The event handlers of the service use the exact same syntax to specify the next state and actions to take.
onError
andonDone
are both optional so you can totally omit them for "fire and forget" services.You can read more about the invoke property here which also explains some properties I haven't covered :)