Ghost/core/server/lib/common/events.js
kirrg001 6f6c8f4521 Import lib/common only
refs #9178

- avoid importing 4 modules (logging, errors, events and i18n)
- simply require common in each file
2017-12-12 10:28:13 +01:00

24 lines
528 B
JavaScript

var events = require('events'),
util = require('util'),
EventRegistry,
EventRegistryInstance;
EventRegistry = function () {
events.EventEmitter.call(this);
};
util.inherits(EventRegistry, events.EventEmitter);
EventRegistry.prototype.onMany = function (arr, onEvent) {
var self = this;
arr.forEach(function (eventName) {
self.on(eventName, onEvent);
});
};
EventRegistryInstance = new EventRegistry();
EventRegistryInstance.setMaxListeners(100);
module.exports = EventRegistryInstance;