mirror of
https://github.com/zadam/trilium.git
synced 2025-11-09 14:55:50 +01:00
upload of modified open file WIP
This commit is contained in:
31
src/public/app/services/file_watcher.js
Normal file
31
src/public/app/services/file_watcher.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import ws from "./ws.js";
|
||||
import appContext from "./app_context.js";
|
||||
|
||||
const fileModificationStatus = {};
|
||||
|
||||
function getFileModificationStatus(noteId) {
|
||||
return fileModificationStatus[noteId];
|
||||
}
|
||||
|
||||
function fileModificationUploaded(noteId) {
|
||||
delete fileModificationStatus[noteId];
|
||||
}
|
||||
|
||||
ws.subscribeToMessages(async message => {
|
||||
if (message.type !== 'openedFileUpdated') {
|
||||
return;
|
||||
}
|
||||
|
||||
fileModificationStatus[message.noteId] = message;
|
||||
|
||||
appContext.triggerEvent('openedFileUpdated', {
|
||||
noteId: message.noteId,
|
||||
lastModifiedMs: message.lastModifiedMs,
|
||||
filePath: message.filePath
|
||||
});
|
||||
});
|
||||
|
||||
export default {
|
||||
getFileModificationStatus,
|
||||
fileModificationUploaded
|
||||
}
|
||||
Reference in New Issue
Block a user