-
-
Couldn't load subscription status.
- Fork 4.7k
Open
Milestone
Description
Describe the problem
The Explicit Resource Management API is nearing Stage 4 and is implemented in TypeScript 5.2
I propose that Svelte 5 make use of patterns added by this proposal.
Describe the proposed solution
Specifically, we could use Symbol.dispose instead of $destroy
const svelteComponent = new MyComponent(options);
svelteComponent.$destroy();
// becomes
const svelteComponent = new MyComponent(options);
svelteComponent[Symbol.dispose]();Additionally, using declarations in the global scope of a script tag should be tied to the component's lifecycle.
using resource = createResource();
// same as
const resource = createResource();
onDestroy(() => {
resource[Symbol.dispose]();
});Alternatives considered
NA
Importance
would make my life easier
mquandalle and MatrosMartz
Metadata
Metadata
Assignees
Labels
No labels