diff --git a/src/indexing/EventIndex.js b/src/indexing/EventIndex.js index 53f47148b9..85e75cfc82 100644 --- a/src/indexing/EventIndex.js +++ b/src/indexing/EventIndex.js @@ -22,8 +22,9 @@ import {EventEmitter} from "events"; /* * Event indexing class that wraps the platform specific event indexing. */ -export default class EventIndex { +export default class EventIndex extends EventEmitter { constructor() { + super(); this.crawlerCheckpoints = []; // The time in ms that the crawler will wait loop iterations if there // have not been any checkpoints to consume in the last iteration. @@ -35,7 +36,6 @@ export default class EventIndex { this._crawler = null; this._currentCheckpoint = null; this.liveEventsForIndex = new Set(); - this._eventEmitter = new EventEmitter(); } async init() { @@ -188,7 +188,7 @@ export default class EventIndex { } emitNewCheckpoint() { - this._eventEmitter.emit("changedCheckpoint", this.currentRoom()); + this.emit("changedCheckpoint", this.currentRoom()); } async crawlerFunc() { @@ -459,12 +459,4 @@ export default class EventIndex { return client.getRoom(this.crawlerCheckpoints[0].roomId); } } - - on(eventName, callback) { - this._eventEmitter.on(eventName, callback); - } - - removeListener(eventName, callback) { - this._eventEmitter.removeListener(eventName, callback); - } }