Add SplitViewsBase class with event listeners and public API

This commit is contained in:
Mauro Balades 2024-08-05 19:19:49 +02:00
parent 6b1bf7b7e5
commit d4e80c2719
4 changed files with 63 additions and 4 deletions

View file

@ -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);
}
};