LiveSplit / livesplit-core

livesplit-core is a library that provides a lot of functionality for creating a speedrun timer.
https://livesplit.org/
Apache License 2.0
209 stars 56 forks source link

Switch `wasm-bindgen` bindings to `Symbol.dispose` #804

Closed CryZe closed 1 month ago

CryZe commented 1 month ago

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.