File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
packages/svelte/src/internal/client Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,14 @@ export function set_current_component_context(context) {
133
133
current_component_context = context ;
134
134
}
135
135
136
+ /** @type {Function[] } */
137
+ export let deferred_tasks = [ ] ;
138
+
139
+ /** @param {Function } task */
140
+ export function defer ( task ) {
141
+ deferred_tasks . push ( task ) ;
142
+ }
143
+
136
144
/**
137
145
* The current component function. Different from current component context:
138
146
* ```html
@@ -561,7 +569,7 @@ function infinite_loop_guard() {
561
569
* @returns {void }
562
570
*/
563
571
function flush_queued_root_effects ( root_effects ) {
564
- const length = root_effects . length ;
572
+ var length = root_effects . length ;
565
573
if ( length === 0 ) {
566
574
return ;
567
575
}
@@ -585,6 +593,10 @@ function flush_queued_root_effects(root_effects) {
585
593
flush_queued_effects ( collected_effects ) ;
586
594
}
587
595
}
596
+
597
+ for ( i = 0 ; i < deferred_tasks . length ; i ++ ) {
598
+ deferred_tasks [ i ] ( ) ;
599
+ }
588
600
} finally {
589
601
is_flushing_effect = previously_flushing_effect ;
590
602
}
You can’t perform that action at this time.
0 commit comments