Added event calls to tabs control.
This commit is contained in:
parent
1e439b87c0
commit
2f4eb11bfa
1 changed files with 14 additions and 1 deletions
|
@ -84,8 +84,15 @@ const MamiTabsControl = function(options) {
|
||||||
|
|
||||||
await onSwitch(cbCtx);
|
await onSwitch(cbCtx);
|
||||||
|
|
||||||
if(prevTab !== undefined)
|
if(typeof result.info.onTabForeground === 'function')
|
||||||
|
await result.info.onTabForeground();
|
||||||
|
|
||||||
|
if(prevTab !== undefined) {
|
||||||
|
if(typeof prevTab.onTabBackground === 'function')
|
||||||
|
await prevTab.onTabBackground();
|
||||||
|
|
||||||
await doTransition(transition, cbCtx);
|
await doTransition(transition, cbCtx);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getExistingTabId = tabInfo => {
|
const getExistingTabId = tabInfo => {
|
||||||
|
@ -133,6 +140,9 @@ const MamiTabsControl = function(options) {
|
||||||
onClick: () => switchTab(tabInfo),
|
onClick: () => switchTab(tabInfo),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(typeof tabInfo.onTabAdd === 'function')
|
||||||
|
await tabInfo.onTabAdd();
|
||||||
|
|
||||||
if(currentTab === undefined)
|
if(currentTab === undefined)
|
||||||
await switchTab(tabInfo);
|
await switchTab(tabInfo);
|
||||||
|
|
||||||
|
@ -153,6 +163,9 @@ const MamiTabsControl = function(options) {
|
||||||
elem: element,
|
elem: element,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(typeof tabInfo.onTabRemove === 'function')
|
||||||
|
await tabInfo.onTabRemove();
|
||||||
|
|
||||||
if(currentTab === result.info)
|
if(currentTab === result.info)
|
||||||
await switchTab(tabs.size > 0 ? tabs.keys().next().value : undefined);
|
await switchTab(tabs.size > 0 ? tabs.keys().next().value : undefined);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue