Iterates through all the persistent handles in the current isolate's heap that have class_ids and returns the ones matching specific class_id.
npm install persistents-with-classid
const persistents = require('persistents-with-classid');
var iv1, iv2
function onTimeout() {
clearInterval(iv1);
}
function Me() {}
Me.prototype.timeout = function () {
clearInterval(iv2);
}
iv1 = setInterval(onTimeout, 20);
iv2 = setInterval(new Me().timeout, 30);
const result = persistents.collect();
function inspect(obj, depth) {
console.error(require('util').inspect(obj, false, depth || 5, true));
}
inspect(result, 3);
{ '17':
[ Timer {
'0': [Function: listOnTimeout],
_idleNext:
{ _called: false,
_idleTimeout: 20,
_idlePrev: [Circular],
_idleNext: [Circular],
_idleStart: 130,
_onTimeout: [Function: wrapper],
_repeat: [Function: onTimeout] },
_idlePrev:
{ _called: false,
_idleTimeout: 20,
_idlePrev: [Circular],
_idleNext: [Circular],
_idleStart: 130,
_onTimeout: [Function: wrapper],
_repeat: [Function: onTimeout] },
msecs: 20 },
Timer {
'0': [Function: listOnTimeout],
_idleNext:
{ _called: false,
_idleTimeout: 30,
_idlePrev: [Circular],
_idleNext: [Circular],
_idleStart: 130,
_onTimeout: [Function: wrapper],
_repeat: [Function] },
[ ... ]
msecs: 30 } ] }
-
Visits all persistents with class id and collects them grouped by class id.
Name Type Argument Description classIds
Array <optional>
filter of class ids of Objects to call back with, defaults to async_wrap providers
- Source:
a hash table keyed by class ids with each value being an array of objects with that class id i.e.:
{ classid-x: [ object, object ] }
- Type
- Object
-
Visits all persistents with class id and calls back with the ones that the user is interested in.
Name Type Argument Description fn
function function called with each Object matching the class id filter with signature:
callback(classid, object)
classIds
Array <optional>
filter of class ids of Objects to call back with, defaults to async_wrap providers
- Source:
generated with docme
{ NONE: 0,
CRYPTO: 1,
FSEVENTWRAP: 2,
FSREQWRAP: 3,
GETADDRINFOREQWRAP: 4,
GETNAMEINFOREQWRAP: 5,
JSSTREAM: 6,
PIPEWRAP: 7,
PIPECONNECTWRAP: 8,
PROCESSWRAP: 9,
QUERYWRAP: 10,
SHUTDOWNWRAP: 11,
SIGNALWRAP: 12,
STATWATCHER: 13,
TCPWRAP: 14,
TCPCONNECTWRAP: 15,
TIMERWRAP: 16,
TLSWRAP: 17,
TTYWRAP: 18,
UDPWRAP: 19,
UDPSENDWRAP: 20,
WRITEWRAP: 21,
ZLIB: 22 }
To submit a bug report, please create an issue at GitHub.
If you'd like to contribute code to this project, please read the CONTRIBUTING.md document.
Thorsten Lorenz | GitHub/thlorenz | Twitter/@thlorenz |
---|
persistents-with-classid is Copyright (c) 2016 NodeSource and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.