* @returns {void}
()
| 7 | * @returns {void} |
| 8 | */ |
| 9 | function run_tasks() { |
| 10 | // use `raf.now()` instead of the `requestAnimationFrame` callback argument, because |
| 11 | // otherwise things can get wonky https://github.com/sveltejs/svelte/pull/14541 |
| 12 | const now = raf.now(); |
| 13 | |
| 14 | raf.tasks.forEach((task) => { |
| 15 | if (!task.c(now)) { |
| 16 | raf.tasks.delete(task); |
| 17 | task.f(); |
| 18 | } |
| 19 | }); |
| 20 | |
| 21 | if (raf.tasks.size !== 0) { |
| 22 | raf.tick(run_tasks); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Creates a new task that runs on each raf frame |