destruction-notifiable

0.0.3 • Public • Published

destruction-notifiable-js

Node.js destruction notifiable types (N-API).

Usage:

// test.js
var dn = require('destruction-notifiable');
 
function forceGC() {
    if (global.gc) {
        global.gc();
    } else {
        console.warn('No GC hook! Start your program as `node --expose-gc ./test.js`.');
    }
}
 
function test() {
    var obj = new dn.Destructible(42, function(id) {
        console.log("object destructed " + id);
    });
}
 
test();
forceGC();

Run:

node --expose-gc ./test.js

Expected output:

object destructed 42

Package Sidebar

Install

npm i destruction-notifiable

Weekly Downloads

5

Version

0.0.3

License

MIT

Unpacked Size

1.88 MB

Total Files

536

Last publish

Collaborators

  • fpelliccioni