Last active
July 31, 2023 07:45
-
-
Save MariusBongarts/2544c93d5236355cdda379fe6e99f0db to your computer and use it in GitHub Desktop.
Using keyword example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
const getResource = () => { | |
return { | |
[Symbol.dispose]: () => { | |
console.log('Clean up done!') | |
} | |
} | |
} | |
using resource = getResource(); | |
} // 'Clean up done!' logged to console because `resource` left the scope |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment