mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
- Update all references to common.errors to use @tryghost/errors - Use dereferencing to only require used bits of common in each file
13 lines
374 B
JavaScript
13 lines
374 B
JavaScript
const {events} = require('../../../lib/common');
|
|
const INVALIDATE_ALL = '/*';
|
|
|
|
module.exports = function emitEvents(req, res, next) {
|
|
res.on('finish', function triggerEvents() {
|
|
if (res.get('X-Cache-Invalidate') === INVALIDATE_ALL) {
|
|
events.emit('site.changed');
|
|
}
|
|
|
|
res.removeListener('finish', triggerEvents);
|
|
});
|
|
next();
|
|
};
|