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) })