@nitedani/inspector-api
Version:
A simple node module to access V8 inspector + some tools to export and read the data.
36 lines (35 loc) • 1.09 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Inspector = void 0;
const inspector_1 = require("inspector");
const profiler_1 = __importDefault(require("./profiler"));
const heap_1 = __importDefault(require("./heap"));
class Inspector {
session;
profiler;
heap;
constructor() {
const session = new inspector_1.Session();
session.connect();
this.session = session;
this.profiler = new profiler_1.default(this.session);
this.heap = new heap_1.default(this.session);
}
getCurrentSession() {
return this.session;
}
async destroy() {
if (!this.session) {
return;
}
await this.profiler.disable();
await this.heap.disable();
this.session.disconnect();
this.session = null;
}
}
exports.Inspector = Inspector;
exports.default = Inspector;