frontend API additions

This commit is contained in:
zadam 2019-04-09 21:13:47 +02:00
parent 83b4382787
commit a27525af9e

View file

@ -131,6 +131,14 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
}
};
/**
* Returns note by given noteId. If note is missing from cache, it's loaded.
**
* @param {string} noteId
* @return {Promise<NoteShort>}
*/
this.getNote = async noteId => await treeCache.getNote(noteId);
/**
* Returns list of notes. If note is missing from cache, it's loaded.
*
@ -210,6 +218,12 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
*/
this.getActiveNote = noteDetailService.getActiveNote;
/**
* @method
* @returns {string} returns note path of active note
*/
this.getActiveNotePath = treeService.getActiveNotePath;
/**
* This method checks whether user navigated away from the note from which the scripts has been started.
* This is necessary because script execution is async and by the time it is finished, the user might have