Ghost/core/server/lib/common/events.js

22 lines
502 B
JavaScript
Raw Normal View History

const events = require('events'),
util = require('util');
let EventRegistry,
EventRegistryInstance;
2016-04-10 03:20:56 +03:00
EventRegistry = function () {
events.EventEmitter.call(this);
};
util.inherits(EventRegistry, events.EventEmitter);
EventRegistry.prototype.onMany = function (arr, onEvent) {
arr.forEach((eventName) => {
this.on(eventName, onEvent);
});
};
EventRegistryInstance = new EventRegistry();
EventRegistryInstance.setMaxListeners(100);
module.exports = EventRegistryInstance;