include.js 397 B

1234567891011121314151617
  1. const
  2. magic = require('./build/Release/memwatch'),
  3. events = require('events');
  4. module.exports = new events.EventEmitter();
  5. module.exports.gc = magic.gc;
  6. module.exports.HeapDiff = magic.HeapDiff;
  7. magic.upon_gc(function(has_listeners, event, data) {
  8. if (has_listeners) {
  9. return (module.exports.listeners('stats').length > 0);
  10. } else {
  11. return module.exports.emit(event, data);
  12. }
  13. });