MCPcopy
hub / github.com/sveltejs/svelte / flushSync

Function flushSync

packages/svelte/src/internal/client/reactivity/batch.js:1006–1033  ·  packages/svelte/src/internal/client/reactivity/batch.js::flushSync
(fn)

Source from the content-addressed store, hash-verified

1004 * @returns {T}
1005 */
1006export function flushSync(fn) {
1007 var was_flushing_sync = is_flushing_sync;
1008 is_flushing_sync = true;
1009
1010 try {
1011 var result;
1012
1013 if (fn) {
1014 if (current_batch !== null && !current_batch.is_fork) {
1015 current_batch.flush();
1016 }
1017
1018 result = fn();
1019 }
1020
1021 while (true) {
1022 flush_tasks();
1023
1024 if (current_batch === null) {
1025 return /** @type {T} */ (result);
1026 }
1027
1028 current_batch.flush();
1029 }
1030 } finally {
1031 is_flushing_sync = was_flushing_sync;
1032 }
1033}
1034
1035function infinite_loop_guard() {
1036 if (DEV) {

Callers 15

date.test.tsFile · 0.90
map.test.tsFile · 0.90
set.test.tsFile · 0.90
url.test.tsFile · 0.90
constructorMethod · 0.90
tickFunction · 0.90
resolveFunction · 0.90
tickFunction · 0.90
run_test_variantFunction · 0.90
testFunction · 0.90
testFunction · 0.90

Calls 3

flush_tasksFunction · 0.90
flushMethod · 0.80
fnFunction · 0.70

Tested by 15

testFunction · 0.72
testFunction · 0.72
testFunction · 0.72
testFunction · 0.72
testFunction · 0.72
testFunction · 0.72
testFunction · 0.72
testFunction · 0.72
testFunction · 0.72
testFunction · 0.72
testFunction · 0.72
testFunction · 0.72