mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
37 lines
821 B
JavaScript
37 lines
821 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];
|
|
}
|
|
|
|
function ignoreModification(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,
|
|
ignoreModification
|
|
}
|