| 197 | |
| 198 | /** Stop the current `runAsync` call with `finished: false` (or with `cancelled: true` when `cancelId` is defined) */ |
| 199 | export function stopAsync(state: RunAsyncState, cancelId?: number | Falsy) { |
| 200 | flush(state.timeouts, t => t.cancel()) |
| 201 | state.pauseQueue.clear() |
| 202 | state.resumeQueue.clear() |
| 203 | state.asyncId = state.asyncTo = state.promise = undefined |
| 204 | if (cancelId) state.cancelId = cancelId |
| 205 | } |
| 206 | |
| 207 | /** This error is thrown to signal an interrupted async animation. */ |
| 208 | export class BailSignal extends Error { |