2018-03-09 22:59:12 +02:00
|
|
|
const events = require('events');
|
2017-11-30 01:03:10 +02:00
|
|
|
|
|
|
|
class EventManager {
|
2018-03-09 22:59:12 +02:00
|
|
|
|
2017-11-30 01:03:10 +02:00
|
|
|
constructor() {
|
|
|
|
this.emitter_ = new events.EventEmitter();
|
|
|
|
}
|
|
|
|
|
|
|
|
on(eventName, callback) {
|
|
|
|
return this.emitter_.on(eventName, callback);
|
|
|
|
}
|
|
|
|
|
|
|
|
emit(eventName, object = null) {
|
|
|
|
return this.emitter_.emit(eventName, object);
|
|
|
|
}
|
|
|
|
|
|
|
|
removeListener(eventName, callback) {
|
|
|
|
return this.emitter_.removeListener(eventName, callback);
|
|
|
|
}
|
2018-03-09 22:59:12 +02:00
|
|
|
|
2017-11-30 01:03:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const eventManager = new EventManager();
|
|
|
|
|
2018-03-09 22:59:12 +02:00
|
|
|
module.exports = eventManager;
|