GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

Search e01

One query across the encyclopedia, books, dictionary, papers, Wikidata and the developer library. Every hit carries its source.

7 results across 6 corpora for FinalizationRegistry.

Encyclopedia 1

Finalizer

aScript and Python. Syntax varies significantly by language. In Java, a finalizer is a method called finalize() , declared in java.lang.Object . In JavaScript, FinalizationRegistry allows requesting a callback when an object is garbage-collected. In Python, a finalizer is a method called __del__() . In Perl, a finalizer is a method called DESTROY . In C#, a finalizer (called "destructor" in earlier versions of the st

e01 Encyclopedia · CC BY-SA 4.0 · https://en.wikipedia.org/w/index.php?oldid=1377787143

Developer library 6

JavaScript reference

lections - Map - Set - WeakMap - WeakSet ### Structured data - ArrayBuffer - SharedArrayBuffer - DataView - Atomics - JSON ### Managing memory - WeakRef - FinalizationRegistry ### Control abstraction objects - Iterator - AsyncIterator - Promise - GeneratorFunction - AsyncGeneratorFunction - Generator - AsyncGenerator - AsyncFunction - DisposableStack - AsyncDisposableStack ### Reflection - AbstractModuleSour

MDN Web Docs mirror · CC BY-SA 2.5 (MDN) · https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference

Standard built-in objects

- ArrayBuffer - SharedArrayBuffer - DataView - Atomics - JSON ### Managing memory These objects interact with the garbage collection mechanism. - WeakRef - FinalizationRegistry ### Control abstraction objects Control abstractions can help to structure code, especially async code (without using deeply nested callbacks, for example). - Iterator - AsyncIterator - Promise - GeneratorFunction - AsyncGeneratorFuncti

WeakRef

n another of them (in the same job), you won't get the target object from one of them but `undefined` from another. - If the target of a `WeakRef` is also in a FinalizationRegistry, the `WeakRef`'s target is cleared at the same time or before any cleanup callback associated with the registry is called; if your cleanup callback calls `deref` on a `WeakRef` for the object, it will receive `undefined`. - You cannot chan

FinalizationRegistry

A **`FinalizationRegistry`** object lets you request a callback when a value is garbage-collected. ## Description `FinalizationRegistry` provides a way to request that a _cleanup callback_ get called at some point when a value registered with the registry has been _reclaimed_ (garbage-collected). (Cleanup callbacks are sometimes called _finalizers_.) > [!NOTE] > Cleanup callbacks should not be used for essential p

FinalizationRegistry.prototype.register()

The **`register()`** method of FinalizationRegistry instances registers a value with this `FinalizationRegistry` so that if the value is garbage-collected, the registry's callback may get called. ## Syntax ```js-nolint register(target, heldValue) register(target, heldValue, unregisterToken) ``` ### Parameters - `target` - : The target value to register. - `heldValue` - : The value to pass to the finalizer for

FinalizationRegistry() constructor

The **`FinalizationRegistry()`** constructor creates FinalizationRegistry objects. ## Syntax ```js-nolint new FinalizationRegistry(callbackFn) ``` > [!NOTE] > `FinalizationRegistry()` can only be constructed with [`new`](/docs/Web/JavaScript/Reference/Operators/new). Attempting to call it without `new` throws a TypeError. ### Parameters - `callback` - : A function to be invoked each time a registered target va

JSON results · Services directory