mirror of
https://github.com/zadam/trilium.git
synced 2025-11-08 22:35:50 +01:00
32 lines
713 B
JavaScript
32 lines
713 B
JavaScript
|
|
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
|
||
|
|
}
|