From b066902d300c9f3c5a53e18a95817f0765fb45e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Alvarez?= Date: Mon, 29 Jul 2024 10:53:36 +0200 Subject: [PATCH] feat(packages/sui-performance): move queue --- packages/sui-performance/src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sui-performance/src/index.js b/packages/sui-performance/src/index.js index 6ef0e8728..a832d508c 100644 --- a/packages/sui-performance/src/index.js +++ b/packages/sui-performance/src/index.js @@ -1,7 +1,5 @@ import {IdleQueue} from 'idlefy' -const queue = new IdleQueue({ensureTasksRun: true}) - export function delayTask() { return new Promise(resolve => { setTimeout(resolve, 100) @@ -12,6 +10,8 @@ export function delayTask() { } export function delayTaskUntilUrgent(options) { + const queue = new IdleQueue({ensureTasksRun: true}) + return new Promise(resolve => { queue.pushTask(resolve, options) })