reportManager.on() callback needs .bind(this)

This commit is contained in:
jesopo 2022-07-03 19:33:57 +00:00
parent cc063f8b0b
commit 572012190e

View File

@ -265,7 +265,7 @@ export class Mjolnir {
// Setup Web APIs // Setup Web APIs
console.log("Creating Web APIs"); console.log("Creating Web APIs");
const reportManager = new ReportManager(this); const reportManager = new ReportManager(this);
reportManager.on("report.new", this.handleReport); reportManager.on("report.new", this.handleReport.bind(this));
this.webapis = new WebAPIs(reportManager, this.ruleServer); this.webapis = new WebAPIs(reportManager, this.ruleServer);
if (config.pollReports) { if (config.pollReports) {
this.reportPoller = new ReportPoller(this, reportManager); this.reportPoller = new ReportPoller(this, reportManager);