UNPKG

nope-js-node

Version:

NoPE Runtime for Nodejs. For Browser-Support please use nope-browser

30 lines (29 loc) 1.27 kB
/** * @modue gc * * Module to interact with the `garbage collector` (`gc`) of Nodejs. * * - Use the function `registerGarbageCallback` if you want to register a callback which will be called, if the item is getting remove by the gc. * - Try to call `forceGarbageCollection` to manually trigger the `gc`. */ /** * Helper trying to call the carbage collection. * - Wont raise an exception, if the gc is not available. * - it isn't shure that the gc will be called. */ export declare function forceGarbageCollection(): void; /** * A `Finalizer`, provided as true `Singleton` * * Check the description: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry to get a better understanding of a `Finalizer` */ export declare const FINALIZER: { instance: FinalizationRegistry<(...args: any[]) => any>; setInstance: (value: FinalizationRegistry<(...args: any[]) => any>) => void; }; /** * Helper to register a callback which will be called, if the item is getting remove by the gc. * @param item The item to be collected by the gc. * @param callback The callback to call. */ export declare function registerGarbageCallback(item: any, callback: (...args: any[]) => any): void;