@@ -6,22 +6,13 @@ const request_idle_callback =
66 ? ( /** @type {() => void } */ cb ) => setTimeout ( cb , 1 )
77 : requestIdleCallback ;
88
9- /** @type {Array<() => void> } */
10- let boundary_micro_tasks = [ ] ;
11-
129/** @type {Array<() => void> } */
1310let micro_tasks = [ ] ;
1411
1512/** @type {Array<() => void> } */
1613let idle_tasks = [ ] ;
1714
18- function run_boundary_micro_tasks ( ) {
19- var tasks = boundary_micro_tasks ;
20- boundary_micro_tasks = [ ] ;
21- run_all ( tasks ) ;
22- }
23-
24- function run_post_micro_tasks ( ) {
15+ function run_micro_tasks ( ) {
2516 var tasks = micro_tasks ;
2617 micro_tasks = [ ] ;
2718 run_all ( tasks ) ;
@@ -33,29 +24,13 @@ function run_idle_tasks() {
3324 run_all ( tasks ) ;
3425}
3526
36- function run_micro_tasks ( ) {
37- run_boundary_micro_tasks ( ) ;
38- run_post_micro_tasks ( ) ;
39- }
40-
41- /**
42- * @param {() => void } fn
43- */
44- export function queue_boundary_micro_task ( fn ) {
45- if ( boundary_micro_tasks . length === 0 && micro_tasks . length === 0 ) {
46- queueMicrotask ( run_micro_tasks ) ;
47- }
48-
49- // TODO do we need to differentiate between `boundary_micro_tasks` and `micro_tasks`?
50- // nothing breaks if we push everything to `micro_tasks`
51- boundary_micro_tasks . push ( fn ) ;
52- }
27+ export { queue_micro_task as queue_boundary_micro_task } ;
5328
5429/**
5530 * @param {() => void } fn
5631 */
5732export function queue_micro_task ( fn ) {
58- if ( boundary_micro_tasks . length === 0 && micro_tasks . length === 0 ) {
33+ if ( micro_tasks . length === 0 ) {
5934 queueMicrotask ( run_micro_tasks ) ;
6035 }
6136
@@ -77,7 +52,7 @@ export function queue_idle_task(fn) {
7752 * Synchronously run any queued tasks.
7853 */
7954export function flush_tasks ( ) {
80- if ( boundary_micro_tasks . length > 0 || micro_tasks . length > 0 ) {
55+ if ( micro_tasks . length > 0 ) {
8156 run_micro_tasks ( ) ;
8257 }
8358
0 commit comments