pull/17124/head
Elliott Johnson 2 weeks ago
parent 8939bbfbc2
commit 0f6001d152

@ -53,14 +53,19 @@ class Resource {
const p = get(this.#promise); const p = get(this.#promise);
return async (resolve, reject) => { return async (resolve, reject) => {
try { const result = /** @type {Promise<Awaited<T>>} */ (
(async () => {
await p; await p;
await tick(); await tick();
return get(this.#current);
})()
);
resolve?.(/** @type {Awaited<T>} */ (get(this.#current))); if (resolve || reject) {
} catch (error) { return result.then(resolve, reject);
reject?.(error);
} }
return result;
}; };
}); });
@ -127,10 +132,7 @@ class Resource {
get finally() { get finally() {
get(this.#then); get(this.#then);
return (/** @type {any} */ fn) => { return (/** @type {any} */ fn) => {
return get(this.#then)( return get(this.#then)().finally(fn);
() => fn(),
() => fn()
);
}; };
} }

Loading…
Cancel
Save