more refactorings

This commit is contained in:
zadam
2020-01-19 21:24:14 +01:00
parent 0760dc742b
commit 562c729ed6
4 changed files with 30 additions and 54 deletions

View File

@@ -180,9 +180,14 @@ class AppContext {
return this.tabContexts;
}
/** @returns {TabContext} */
getTabContextById(tabId) {
return this.tabContexts.find(tc => tc.tabId === tabId);
}
/** @returns {TabContext} */
getActiveTabContext() {
return this.tabContexts.find(tc => tc.tabId === this.activeTabId);
return this.getTabContextById(this.activeTabId);
}
/** @returns {string|null} */
@@ -253,14 +258,6 @@ class AppContext {
}
}
async refreshTabs(sourceTabId, noteId) {
for (const tc of this.tabContexts) {
if (tc.noteId === noteId && tc.tabId !== sourceTabId) {
await this.reloadTab(tc);
}
}
}
async reloadTab(tc) {
if (tc.note) {
noteDetailService.reloadNote(tc);