Created
September 10, 2024 07:34
-
-
Save DIY0R/d5c0d20f80eaf7d9d7df3b1519086932 to your computer and use it in GitHub Desktop.
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
let obj = {}; | |
let weakRef = new WeakRef(obj); | |
let finalizationRegistry = new FinalizationRegistry(() => { | |
console.log('Object has been collected'); | |
}); | |
finalizationRegistry.register(obj); | |
obj = null; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment