Skip to content

Instantly share code, notes, and snippets.

@MariusBongarts
Last active July 31, 2023 07:45
Show Gist options
  • Save MariusBongarts/2544c93d5236355cdda379fe6e99f0db to your computer and use it in GitHub Desktop.
Save MariusBongarts/2544c93d5236355cdda379fe6e99f0db to your computer and use it in GitHub Desktop.
Using keyword example
{
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