pull/16197/head
Rich Harris 4 months ago
parent f584d0d7d4
commit 7dc2019e3f

@ -39,7 +39,8 @@ export class Batch {
#pending = 0;
/** @type {PromiseWithResolvers<void> | null} */
/** @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null} */
// TODO replace with Promise.withResolvers once supported widely enough
deferred = null;
/** @type {Effect[]} */

@ -1,6 +1,12 @@
/** @import { ComponentContext, Derived, Effect, Reaction, Signal, Source, Value } from '#client' */
import { DEV } from 'esm-env';
import { define_property, get_descriptors, get_prototype_of, index_of } from '../shared/utils.js';
import {
deferred,
define_property,
get_descriptors,
get_prototype_of,
index_of
} from '../shared/utils.js';
import {
destroy_block_effect_children,
destroy_effect_children,
@ -893,7 +899,7 @@ export async function tick() {
* @returns {Promise<void>}
*/
export function settled() {
return (Batch.ensure().deferred ??= Promise.withResolvers()).promise;
return (Batch.ensure().deferred ??= deferred()).promise;
}
/**

Loading…
Cancel
Save