From a27525af9e3454f041cef62eb5d597eb1a75b7eb Mon Sep 17 00:00:00 2001 From: zadam Date: Tue, 9 Apr 2019 21:13:47 +0200 Subject: [PATCH] frontend API additions --- .../javascripts/services/frontend_script_api.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/public/javascripts/services/frontend_script_api.js b/src/public/javascripts/services/frontend_script_api.js index 0fa7d98fb..349a90f2a 100644 --- a/src/public/javascripts/services/frontend_script_api.js +++ b/src/public/javascripts/services/frontend_script_api.js @@ -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} + */ + 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