blob: c7a748009f3b14637a68b293c8c445d77a9ecdbb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
var registry = new FinalizationRegistry(x => {
if (target1 === null) {
return;
}
target1 = null;
gc();
print("targets:", [...x]); // consume
});
var target1 = {};
registry.register(target1, "target1");
var target2 = {};
registry.register(target2, "target2");
target2 = null;
gc();
|