mirror of https://github.com/sveltejs/svelte
parent
c4a948def3
commit
93125942d7
@ -0,0 +1,15 @@
|
||||
import { STALE_REACTION } from '#client/constants';
|
||||
|
||||
/** @type {AbortController | null} */
|
||||
export let controller = null;
|
||||
|
||||
export function abort() {
|
||||
if (controller !== null) {
|
||||
controller.abort(STALE_REACTION);
|
||||
controller = null;
|
||||
}
|
||||
}
|
||||
|
||||
export function getAbortSignal() {
|
||||
return (controller ??= new AbortController()).signal;
|
||||
}
|
Loading…
Reference in new issue