import { Context } from "../core/index.js"; export interface AsyncContextParent { /** * Called by async contexts to track a pending task. */ track(task: Promise): void; } /** * Represents pending operations in an asynchronously rendered tree. * * This can be used to wait until an entire async tree is rendered or to check if any unhandled errors occurred. */ export declare class AsyncContext { #private; constructor(parent?: AsyncContextParent); /** * Reactively check if there are any pending tasks in this context. * * @example * ```tsx * *
Please wait...
*
* ``` */ pending: () => boolean; /** * Track the specified task in this and all parent contexts. */ track(task: Promise): void; /** * Wait until all tracked tasks in this and all child contexts have completed. * * This also includes new tasks that are tracked while waiting. * * @throws Errors thrown by any tracked task or an {@link AsyncError} if multiple tasks failed. */ complete(): Promise; /** * Create a new async context using the current context as parent. */ static fork(): AsyncContext; } /** * Thrown by {@link AsyncContext.complete} if multiple unhandled {@link errors} occurred. */ export declare class AsyncError extends Error { errors: unknown[]; constructor(errors: unknown[]); } /** * Context for the current {@link AsyncContext}. */ export declare const ASYNC: Context; //# sourceMappingURL=async-context.d.ts.map