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