(phase, payload = {}, extraState = {})
| 3787 | } |
| 3788 | |
| 3789 | async function broadcastAutoRunStatus(phase, payload = {}, extraState = {}) { |
| 3790 | const rawScheduledAt = phase === 'scheduled' |
| 3791 | ? (payload.scheduledAt ?? payload.scheduledAutoRunAt ?? null) |
| 3792 | : null; |
| 3793 | const rawCountdownAt = payload.countdownAt ?? payload.autoRunCountdownAt ?? null; |
| 3794 | const statusPayload = { |
| 3795 | phase, |
| 3796 | currentRun: payload.currentRun ?? autoRunCurrentRun, |
| 3797 | totalRuns: payload.totalRuns ?? autoRunTotalRuns, |
| 3798 | attemptRun: payload.attemptRun ?? autoRunAttemptRun, |
| 3799 | scheduledAt: rawScheduledAt === null ? null : Number(rawScheduledAt), |
| 3800 | countdownAt: rawCountdownAt === null ? null : Number(rawCountdownAt), |
| 3801 | countdownTitle: payload.countdownTitle === undefined ? '' : String(payload.countdownTitle || ''), |
| 3802 | countdownNote: payload.countdownNote === undefined ? '' : String(payload.countdownNote || ''), |
| 3803 | }; |
| 3804 | |
| 3805 | await setState({ |
| 3806 | ...extraState, |
| 3807 | ...getAutoRunStatusPayload(phase, statusPayload), |
| 3808 | }); |
| 3809 | chrome.runtime.sendMessage({ |
| 3810 | type: 'AUTO_RUN_STATUS', |
| 3811 | payload: statusPayload, |
| 3812 | }).catch(() => { }); |
| 3813 | } |
| 3814 | |
| 3815 | function isAutoRunLockedState(state) { |
| 3816 | return Boolean(state.autoRunning) |
no test coverage detected