JavaScript Explicit Resource Management: using and Symbol.dispose
Explicit resource management in JavaScript: using and Symbol.dispose Cleanup code is easy to forget on the error path: an event listener that is never removed, an IntersectionObserver that keeps running, a lock that stays taken because an exception jumped over the release(). try/finally solves it, but nested finally blocks for three resources are hard to…