3 ms·
File handle destructor: https://nodejs.org/api/fs.html#filehandleclose https://nodejs.org/api/fs.html#filehandleclose WebSocket's destructor: https://developer
by mort96 4y ago
File handle destructor: https://nodejs.org/api/fs.html#filehandleclose https://nodejs.org/api/fs.html#filehandleclose
WebSocket's destructor: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/c...
HTTP server's destructor: https://nodejs.org/api/http.html#serverclosecallback https://nodejs.org/api/http.html#serverclosecallback
Etc etc etc.
You're right that JS/C/Go don't have language features called destructors, but they have a whole bunch of types with ad-hoc destructor functions which you have to remember to call if you want to avoid leaking resources.
- bakkoting 4y agoThere's a proposal for syntax to help with this in JS, incidentally: https://github.com/tc39/proposal-explicit-resource-management https://github.com/tc39/proposal-explicit-resource-managemen...