mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 01:41:46 +03:00
bd597db829
- This is part of the quest to separate the frontend and server & get rid of all the places where there are cross-requires - At the moment the settings cache is one big shared cache used by the frontend and server liberally - This change doesn't really solve the fundamental problems, as we still depend on events, and requires from inside frontend - However it allows us to control the misuse slightly better by getting rid of restricted requires and turning on that eslint ruleset
29 lines
911 B
JavaScript
29 lines
911 B
JavaScript
/**
|
|
* Why has this not been moved to e.g. @tryghost/events or shared yet?
|
|
*
|
|
* - We currently massively overuse this utility, coupling together bits of the codebase in unexpected ways
|
|
* - We want to prevent this, not reinforce it
|
|
* * Having an @tryghost/events or shared/events module would reinforce this bad patter of using the same event emitter everywhere
|
|
*
|
|
* - Ideally, we want to refactor to:
|
|
* - either remove dependence on events where we can
|
|
* - or have separate event emitters for e.g. model layer and routing layer
|
|
*
|
|
*/
|
|
|
|
const events = require('events');
|
|
const util = require('util');
|
|
let EventRegistry;
|
|
let EventRegistryInstance;
|
|
|
|
EventRegistry = function () {
|
|
events.EventEmitter.call(this);
|
|
};
|
|
|
|
util.inherits(EventRegistry, events.EventEmitter);
|
|
|
|
EventRegistryInstance = new EventRegistry();
|
|
EventRegistryInstance.setMaxListeners(100);
|
|
|
|
module.exports = EventRegistryInstance;
|