diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2021-07-02 10:46:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-02 10:46:37 +0200 |
commit | 513f921219d32fe5deea264f6604b54b24d81d8f (patch) | |
tree | 17344527b40bdfcaaed0e55569faa0b4abffab61 /cli/tests/finalization_registry.js | |
parent | 5648b22fe102c212a653580d2e190283c057cc20 (diff) |
feat(core): pump V8 message loop on event loop tick (#11221)
This commit adds support for Atomics and FinalizationRegistry by integrating
V8's message loop into "JsRuntime::poll_event_loop".
Diffstat (limited to 'cli/tests/finalization_registry.js')
-rw-r--r-- | cli/tests/finalization_registry.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cli/tests/finalization_registry.js b/cli/tests/finalization_registry.js new file mode 100644 index 000000000..f75979358 --- /dev/null +++ b/cli/tests/finalization_registry.js @@ -0,0 +1,20 @@ +// Copyright 2018-2021 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.core.print("FinalizationRegistry called!\n"); +}); + +(function () { + let x = {}; + registry.register(x, "called!"); + x = null; +})(); + +gc(); |