mirror of
https://github.com/zen-browser/components.git
synced 2025-07-09 02:55:31 +02:00
Add SplitViewsBase class with event listeners and public API
This commit is contained in:
parent
6b1bf7b7e5
commit
d4e80c2719
4 changed files with 63 additions and 4 deletions
|
@ -1,2 +1,40 @@
|
|||
|
||||
import Component from '../common/component';
|
||||
import { SplitViewConfig, SplitView } from './types';
|
||||
|
||||
class SplitViewsBase extends Component {
|
||||
data: SplitView[];
|
||||
currentView: number;
|
||||
|
||||
constructor(config: SplitViewConfig) {
|
||||
super(config);
|
||||
this.data = [];
|
||||
this.currentView = -1;
|
||||
this.addEventListeners();
|
||||
this.log('SplitViewsBase initialized');
|
||||
}
|
||||
|
||||
addEventListeners() {
|
||||
// Add event listeners here like TabClose, TabOpen, etc.
|
||||
}
|
||||
|
||||
public 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 gSplitViews extends SplitViewsBase {
|
||||
constructor(config: SplitViewConfig) {
|
||||
super(config);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue