Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
fix(queued): move to next on next tick
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiocro committed Oct 9, 2017
1 parent 829f738 commit 78b325f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/queued.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ export default function queued() {
resolve(result);
}

if (queue.length > 0) {
const { callerContext, execute, args } = queue[0];
setTimeout(() => {
if (queue.length > 0) {
const { callerContext, execute, args } = queue[0];

queue[0].running = true;
execute.apply(callerContext, args);
}
queue[0].running = true;
execute.apply(callerContext, args);
}
}, 0);
};

return function fnWrapper(...args: []): Promise<any> {
Expand Down

0 comments on commit 78b325f

Please sign in to comment.