using dynamic import for dialogs and widgets to speed up initial load

This commit is contained in:
zadam
2019-08-20 21:40:47 +02:00
parent b818f020a7
commit fab4c59f9b
72 changed files with 1393 additions and 450 deletions

View File

@@ -35,8 +35,9 @@ import treeCache from './tree_cache.js';
import noteDetailService from './note_detail.js';
import noteTypeService from './note_type.js';
import noteTooltipService from './note_tooltip.js';
import protectedSessionService from'./protected_session.js';
import dateNotesService from'./date_notes.js';
import protectedSessionService from './protected_session.js';
import dateNotesService from './date_notes.js';
import StandardWidget from '../widgets/standard_widget.js';
/**
* This is the main frontend API interface for scripts. It's published in the local "api" object.
@@ -60,6 +61,9 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
/** @property {TabContext|null} - experimental! */
this.tabContext = tabContext;
/** @property {StandardWidget} */
this.StandardWidget = StandardWidget;
/**
* Activates note in the tree and in the note detail.
*
@@ -67,7 +71,15 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
* @param {string} notePath (or noteId)
* @returns {Promise<void>}
*/
this.activateNote = treeService.activateNote;
this.activateNote = async (notePath, noteLoadedListener) => {
await treeService.activateNote(notePath, async () => {
await treeService.scrollToActiveNote();
if (noteLoadedListener) {
noteLoadedListener();
}
});
};
/**
* Activates newly created note. Compared to this.activateNote() also refreshes tree.
@@ -115,7 +127,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
}
if (opts.shortcut) {
$(document).bind('keydown', opts.shortcut, opts.action);
utils.bindGlobalShortcut(opts.shortcut, opts.action);
button.attr("title", "Shortcut " + opts.shortcut);
}
@@ -401,7 +413,7 @@ export default FrontendScriptApi;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a>
</footer>
<script> prettyPrint(); </script>