node/test/parallel/test-finalization-group.js
Gus Caplan e7c9042c72
src: implement v8 host weakref hooks
PR-URL: https://github.com/nodejs/node/pull/29874
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2020-02-06 02:48:48 +00:00

13 lines
254 B
JavaScript

'use strict';
// Flags: --expose-gc --harmony-weak-refs
const common = require('../common');
const g = new globalThis.FinalizationGroup(common.mustCallAtLeast(1));
g.register({}, 42);
setTimeout(() => {
globalThis.gc();
g.cleanupSome();
}, 200);