mirror of
https://github.com/zen-browser/components.git
synced 2025-07-09 20:15:30 +02:00
feat: Remove unused code and update types
This commit is contained in:
parent
6ad0e99b54
commit
8d0d7b3902
9 changed files with 106 additions and 135 deletions
98
src/splitViews.mjs
Normal file
98
src/splitViews.mjs
Normal file
|
@ -0,0 +1,98 @@
|
|||
|
||||
class SplitViewsBase {
|
||||
/**
|
||||
* @param {SplitViewConfig} config
|
||||
* @param {SplitViewData[]} data
|
||||
* @param {number} currentView
|
||||
* @param {SplitViewConfig} config
|
||||
*/
|
||||
constructor(config) {
|
||||
this.config = config.awd;
|
||||
this.data = [];
|
||||
this.currentView = -1;
|
||||
this.addEventListeners();
|
||||
this.log('SplitViewsBase initialized');
|
||||
}
|
||||
|
||||
addEventListeners() {
|
||||
window.addEventListener('TabClose', this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Event} event
|
||||
*/
|
||||
handleEvent(event) {
|
||||
switch (event.type) {
|
||||
case 'TabClose':
|
||||
this.onTabClose(event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Event} event
|
||||
*/
|
||||
onTabClose(event) {
|
||||
}
|
||||
|
||||
get isActivated() {
|
||||
return this.currentView !== -1;
|
||||
}
|
||||
|
||||
get activeView() {
|
||||
if (!this.isActivated) {
|
||||
throw new Error('No active view');
|
||||
}
|
||||
return this.data[this.currentView];
|
||||
}
|
||||
}
|
||||
|
||||
// Public API exposed by the module
|
||||
export class SplitViews extends SplitViewsBase {
|
||||
/**
|
||||
* @param {SplitViewConfig} config
|
||||
*/
|
||||
constructor(config) {
|
||||
super(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MockedExports.Browser} browser
|
||||
*/
|
||||
onLocationChange(browser) {
|
||||
this.log('onLocationChange');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {SplitType} type
|
||||
*/
|
||||
tileCurrentView(type) {
|
||||
this.log('tileCurrentView');
|
||||
}
|
||||
|
||||
closeCurrentView() {
|
||||
this.log('closeCurrentView');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MockedExports.BrowserTab} tab
|
||||
*/
|
||||
tabIsInActiveView(tab) {
|
||||
this.log('tabIsInActiveView');
|
||||
return false;
|
||||
}
|
||||
|
||||
getActiveViewTabs() {
|
||||
this.log('getActiveViewTabs');
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MockedExports.BrowserTab[]} tabs
|
||||
* @param {SplitType} type
|
||||
* @private
|
||||
*/
|
||||
createSplitView(tabs, type = this.viewConfig.defaultSplitView) {
|
||||
this.log('createSplitView');
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue