Compatibility with extensions

This commit is contained in:
Cohee
2024-04-02 20:25:37 +03:00
parent 534612db87
commit f13e718dc7
3 changed files with 9 additions and 0 deletions

View File

@@ -29,6 +29,12 @@ var EventEmitter = function () {
};
EventEmitter.prototype.on = function (event, listener) {
// Unknown event used by external libraries?
if (event === undefined) {
console.trace('EventEmitter: Cannot listen to undefined event');
return;
}
if (typeof this.events[event] !== 'object') {
this.events[event] = [];
}