runOnNoteChange fires also on the frontend, closes #340

This commit is contained in:
azivner
2019-01-16 22:52:32 +01:00
parent 35edce7523
commit 19d8947123
4 changed files with 15 additions and 3 deletions

View File

@@ -30,9 +30,13 @@ async function executeStartupBundles() {
}
async function executeRelationBundles(note, relationName) {
const bundlesToRun = await server.get("script/relation/" + note.noteId + "/" + relationName);
note.bundleCache = note.bundleCache || {};
for (const bundle of bundlesToRun) {
if (!note.bundleCache[relationName]) {
note.bundleCache[relationName] = await server.get("script/relation/" + note.noteId + "/" + relationName);
}
for (const bundle of note.bundleCache[relationName]) {
await executeBundle(bundle, note);
}
}

View File

@@ -131,6 +131,9 @@ async function saveNote() {
}
$savedIndicator.fadeIn();
// run async
bundleService.executeRelationBundles(getCurrentNote(), 'runOnNoteChange');
}
async function saveNoteIfChanged() {