mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-04 22:27:10 -04:00
Added live reloading.
This commit is contained in:
parent
d522de17e6
commit
bbf4adb075
6 changed files with 144 additions and 91 deletions
|
@ -24,6 +24,7 @@
|
|||
|
||||
let socket;
|
||||
|
||||
|
||||
// These jQuery things should create local references, but for now `require()`
|
||||
// assigns to the global `$` and augments it with plugins.
|
||||
require('./vendors/jquery');
|
||||
|
@ -283,6 +284,7 @@ const handshake = async () => {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
socket.on('error', (error) => {
|
||||
// pad.collabClient might be null if the error occurred before the hanshake completed.
|
||||
if (pad.collabClient != null) {
|
||||
|
@ -315,6 +317,15 @@ const handshake = async () => {
|
|||
() => $.ajax('../_extendExpressSessionLifetime', {method: 'PUT'}).catch(() => {});
|
||||
setInterval(ping, window.clientVars.sessionRefreshInterval);
|
||||
}
|
||||
if(window.clientVars.mode === "development") {
|
||||
console.warn('Enabling development mode with live update')
|
||||
socket.on('liveupdate', ()=>{
|
||||
|
||||
console.log('Live reload update received')
|
||||
location.reload()
|
||||
})
|
||||
}
|
||||
|
||||
} else if (obj.disconnect) {
|
||||
padconnectionstatus.disconnected(obj.disconnect);
|
||||
socket.disconnect();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue