mirror of
https://github.com/zadam/trilium.git
synced 2025-10-28 08:46:43 +01:00
websocket reimplementation of status requests
This commit is contained in:
@@ -139,4 +139,31 @@ function initAjax() {
|
||||
});
|
||||
}
|
||||
|
||||
initAjax();
|
||||
initAjax();
|
||||
|
||||
// use wss for secure messaging
|
||||
const ws = new WebSocket("ws://" + location.host);
|
||||
ws.onopen = function (event) {
|
||||
};
|
||||
|
||||
ws.onmessage = function (event) {
|
||||
console.log(event.data);
|
||||
|
||||
const message = JSON.parse(event.data);
|
||||
|
||||
if (message.type === 'sync') {
|
||||
const data = message.data;
|
||||
|
||||
if (data.notes_tree) {
|
||||
console.log("Reloading tree because of background changes");
|
||||
|
||||
noteTree.reload();
|
||||
}
|
||||
|
||||
if (data.notes && data.notes.includes(noteEditor.getCurrentNoteId())) {
|
||||
showMessage('Reloading note because background change');
|
||||
|
||||
noteEditor.reload();
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user