{ states: { delayed: { after: { 1000: { target: "done" } } }, done: { type: "final" } } }
Delays are defined with special property
after
const machine = Machine({ states: { init: { entry: send("DONE", { id: "delayedEvent", delay: 1000, }), on: { DONE: { target: "ready", }, }, }, ready: { type: "final", }, }, });
is a special event creator from XState
send
const machine = Machine( { states: { ready: { after: { DELAY: {}, }, }, }, }, { delays: { DELAY: 1000, }, } );
By Kuba Skoneczny