mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-10-25 00:53:39 +00:00
And enable the import/unambiguous ESLint rule as a check on our
partition between scripts and modules. After this commit, if you add
a new file and get this error:
✖ 1:1 This module could be parsed as a valid script. import/unambiguous
* For a module, add an `import` or `export` declaration to make the
file unambiguously a module (the empty `export {};` declaration
suffices).
* For a script, add the file to the xo overrides section of
package.json that marks it "sourceType": "script", and add a 'use
strict' declaration.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
45 lines
943 B
TypeScript
45 lines
943 B
TypeScript
import WebView from './webview';
|
|
import BaseComponent from './base';
|
|
|
|
// TODO: TypeScript - Type annotate props
|
|
interface TabProps {
|
|
[key: string]: any;
|
|
}
|
|
|
|
export default 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);
|
|
}
|
|
|
|
showNetworkError(): void {
|
|
this.webview.forceLoad();
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|