(name: PatchyIdleActionName)
| 116 | timers.add(id); |
| 117 | }; |
| 118 | const play = (name: PatchyIdleActionName) => { |
| 119 | if (document.hidden) { |
| 120 | return; |
| 121 | } |
| 122 | const action: PatchyIdleAction = patchyIdleActions[name]; |
| 123 | isBusy = true; |
| 124 | keyRef.current += 1; |
| 125 | setState({ |
| 126 | face: action.face, |
| 127 | motion: prefersReducedMotion ? null : (action.motion ?? null), |
| 128 | key: keyRef.current, |
| 129 | }); |
| 130 | later(() => { |
| 131 | isBusy = false; |
| 132 | setState((current) => ({ ...current, face: null, motion: null })); |
| 133 | }, action.ms); |
| 134 | }; |
| 135 | const blinkLoop = () => { |
| 136 | later(() => { |
| 137 | if (!isBusy) { |
no test coverage detected