Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch wasm-bindgen bindings to Symbol.dispose #804

Merged
merged 1 commit into from
May 18, 2024

Conversation

CryZe
Copy link
Collaborator

@CryZe CryZe commented May 18, 2024

There is a JavaScript proposal for using Symbol.dispose as a way to automatically clean up resources. You do that by declaring variables like so:

using resource = new Resource();

The variable resource will be automatically disposed when it goes out of scope. We used to have our own dispose method and with helper method that allows scoped access to the resource, before it gets cleaned up at the end. TypeScript already fully implements and polyfills support for it, so we can already fully switch over to it.

There is a [JavaScript
proposal](https://github.com/tc39/proposal-explicit-resource-management)
for using `Symbol.dispose` as a way to automatically clean up resources.
You do that by declaring variables like so:
```js
using resource = new Resource();
```
The variable `x` will be automatically disposed when it goes out of
scope. We used to have our own `dispose` method and `with` helper method
that allows scoped access to the resource, before it gets cleaned up at
the end. TypeScript already fully implements and polyfills support for
it, so we can already fully switch over to it.
@CryZe CryZe added enhancement An improvement for livesplit-core. code quality Affects the quality of the code. bindings This is about the bindings / binding generator. labels May 18, 2024
@CryZe CryZe added this to the v0.14 milestone May 18, 2024
@CryZe CryZe requested a review from wooferzfg May 18, 2024 12:22
@CryZe CryZe merged commit 808df28 into LiveSplit:master May 18, 2024
69 of 70 checks passed
@CryZe CryZe deleted the symbol-dispose branch May 18, 2024 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bindings This is about the bindings / binding generator. code quality Affects the quality of the code. enhancement An improvement for livesplit-core.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant