mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-30 14:22:07 +03:00
14 lines
379 B
JavaScript
14 lines
379 B
JavaScript
|
const common = 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) {
|
||
|
common.events.emit('site.changed');
|
||
|
}
|
||
|
|
||
|
res.removeListener('finish', triggerEvents);
|
||
|
});
|
||
|
next();
|
||
|
};
|