pull/17004/head
Rich Harris 4 weeks ago
parent cd4da0e77d
commit bc56dbdb06

@ -348,6 +348,22 @@ declare module 'svelte' {
*/
props: Props;
});
/**
* Represents work that is happening off-screen, such as data being preloaded
* in anticipation of the user navigating
* @since 5.42
*/
export interface Fork {
/**
* Commit the fork. The promise will resolve once the state change has been applied
*/
commit(): Promise<void>;
/**
* Discard the fork
*/
discard(): void;
}
/**
* Returns an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that aborts when the current [derived](https://svelte.dev/docs/svelte/$derived) or [effect](https://svelte.dev/docs/svelte/$effect) re-runs or is destroyed.
*
@ -465,10 +481,7 @@ declare module 'svelte' {
*
* @since 5.42
*/
export function fork(fn: () => void): {
commit: () => void;
discard: () => void;
};
export function fork(fn: () => void): Fork;
/**
* Returns a `[get, set]` pair of functions for working with context in a type-safe way.
*

Loading…
Cancel
Save