mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
refactor: send single message
This commit is contained in:
@@ -173,9 +173,10 @@ module.exports = function (grunt) {
|
|||||||
winston.error(err.stack);
|
winston.error(err.stack);
|
||||||
}
|
}
|
||||||
if (worker) {
|
if (worker) {
|
||||||
worker.send({ compiling: compiling });
|
worker.send({
|
||||||
// Send livereload event via Socket.IO for instant browser refresh
|
compiling: compiling,
|
||||||
worker.send({ livereload: true });
|
livereload: true, // Send livereload event via Socket.IO for instant browser refresh
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -107,7 +107,8 @@ function addProcessHandlers() {
|
|||||||
shutdown(1);
|
shutdown(1);
|
||||||
});
|
});
|
||||||
process.on('message', (msg) => {
|
process.on('message', (msg) => {
|
||||||
if (msg && Array.isArray(msg.compiling)) {
|
if (msg) {
|
||||||
|
if (Array.isArray(msg.compiling)) {
|
||||||
if (msg.compiling.includes('tpl')) {
|
if (msg.compiling.includes('tpl')) {
|
||||||
const benchpressjs = require('benchpressjs');
|
const benchpressjs = require('benchpressjs');
|
||||||
benchpressjs.flush();
|
benchpressjs.flush();
|
||||||
@@ -115,7 +116,9 @@ function addProcessHandlers() {
|
|||||||
const translator = require('./translator');
|
const translator = require('./translator');
|
||||||
translator.flush();
|
translator.flush();
|
||||||
}
|
}
|
||||||
} else if (msg && msg.livereload) {
|
}
|
||||||
|
|
||||||
|
if (msg.livereload) {
|
||||||
// Send livereload event to all connected clients via Socket.IO
|
// Send livereload event to all connected clients via Socket.IO
|
||||||
const websockets = require('./socket.io');
|
const websockets = require('./socket.io');
|
||||||
if (websockets.server) {
|
if (websockets.server) {
|
||||||
@@ -123,6 +126,7 @@ function addProcessHandlers() {
|
|||||||
winston.info('[livereload] Sent reload event to all clients');
|
winston.info('[livereload] Sent reload event to all clients');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user