(action: ExecutableActionsFrom<typeof machine>)
| 432 | }); |
| 433 | |
| 434 | async function execute(action: ExecutableActionsFrom<typeof machine>) { |
| 435 | if (action.type === 'xstate.raise' && action.params.delay) { |
| 436 | const currentTime = Date.now(); |
| 437 | const startedAt = currentTime; |
| 438 | const elapsed = currentTime - startedAt; |
| 439 | const timeRemaining = Math.max(0, action.params.delay - elapsed); |
| 440 | |
| 441 | await new Promise((res) => setTimeout(res, timeRemaining)); |
| 442 | postEvent(action.params.event); |
| 443 | } |
| 444 | } |
| 445 | |
| 446 | // POST /workflow |
| 447 | async function postStart() { |
no test coverage detected
searching dependent graphs…