1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-11 10:07:54 -05:00
denoland-deno/cli/tests/testdata/run/finalization_registry.js
2024-01-01 19:58:21 +00:00

20 lines
433 B
JavaScript

// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
"use strict";
function assertEquals(a, b) {
if (a === b) return;
throw a + " does not equal " + b;
}
const registry = new FinalizationRegistry((value) => {
assertEquals(value, "called!");
Deno[Deno.internal].core.print("FinalizationRegistry called!\n");
});
(function () {
let x = {};
registry.register(x, "called!");
x = null;
})();
gc();