2015-03-24 22:23:23 +02:00
|
|
|
var events = require('events'),
|
|
|
|
util = require('util'),
|
2015-10-09 19:27:49 +01:00
|
|
|
EventRegistry,
|
|
|
|
EventRegistryInstance;
|
2015-03-24 22:23:23 +02:00
|
|
|
|
2016-04-09 19:20:56 -05:00
|
|
|
EventRegistry = function () {
|
|
|
|
events.EventEmitter.call(this);
|
|
|
|
};
|
2016-05-19 13:49:22 +02:00
|
|
|
|
2015-03-24 22:23:23 +02:00
|
|
|
util.inherits(EventRegistry, events.EventEmitter);
|
|
|
|
|
2016-05-19 13:49:22 +02:00
|
|
|
EventRegistry.prototype.onMany = function (arr, onEvent) {
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
arr.forEach(function (eventName) {
|
|
|
|
self.on(eventName, onEvent);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2015-10-09 19:27:49 +01:00
|
|
|
EventRegistryInstance = new EventRegistry();
|
|
|
|
EventRegistryInstance.setMaxListeners(100);
|
|
|
|
|
|
|
|
module.exports = EventRegistryInstance;
|