From 2e82ecce7a375f242ff7021051aba7fd609dcf40 Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Mon, 20 May 2024 22:06:26 +0100 Subject: [PATCH] tweak --- packages/svelte/src/internal/client/runtime.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/svelte/src/internal/client/runtime.js b/packages/svelte/src/internal/client/runtime.js index 935bbe3734..6415abf31a 100644 --- a/packages/svelte/src/internal/client/runtime.js +++ b/packages/svelte/src/internal/client/runtime.js @@ -591,16 +591,16 @@ function process_microtask() { } } -const yield_task = +const request_animation_frame = typeof requestAnimationFrame === 'undefined' ? setTimeout : requestAnimationFrame; async function process_yieldtask() { // TODO: replace this with scheduler.yield when it becomes standard await new Promise((fulfil) => { - yield_task(() => { + request_animation_frame(() => { setTimeout(fulfil, 0); }); - // In case of background task + // In case of being within background tab, the rAF won't fire setTimeout(fulfil, 100); }); is_yield_task_queued = false;