mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-10-24 00:23:36 +00:00
Using `import * as` import syntax causes some problem if the module exports a class or function. Because the whole point of star import is to import every property the module exports. It turns out we have been using it incorrectly in many places which this commit fixes. Then we fix a linting error by adding a eslint disable rule to solve it along with a TODO because the way we currently do it is wrong. Finally, to conclude this cleanup, we merge all the .gitignore paths into once now that we can.
45 lines
910 B
TypeScript
45 lines
910 B
TypeScript
'use strict';
|
|
|
|
import WebView = require('./webview');
|
|
import BaseComponent = require('./base');
|
|
|
|
// TODO: TypeScript - Type annotate props
|
|
interface TabProps {
|
|
[key: string]: any;
|
|
}
|
|
|
|
class Tab extends BaseComponent {
|
|
props: TabProps;
|
|
webview: WebView;
|
|
$el: Element;
|
|
constructor(props: TabProps) {
|
|
super();
|
|
|
|
this.props = props;
|
|
this.webview = this.props.webview;
|
|
}
|
|
|
|
registerListeners(): void {
|
|
this.$el.addEventListener('click', this.props.onClick);
|
|
this.$el.addEventListener('mouseover', this.props.onHover);
|
|
this.$el.addEventListener('mouseout', this.props.onHoverOut);
|
|
}
|
|
|
|
activate(): void {
|
|
this.$el.classList.add('active');
|
|
this.webview.load();
|
|
}
|
|
|
|
deactivate(): void {
|
|
this.$el.classList.remove('active');
|
|
this.webview.hide();
|
|
}
|
|
|
|
destroy(): void {
|
|
this.$el.parentNode.removeChild(this.$el);
|
|
this.webview.$el.parentNode.removeChild(this.webview.$el);
|
|
}
|
|
}
|
|
|
|
export = Tab;
|