|
|
|
@ -72,6 +72,7 @@ export class MainHeader extends React.Component<Props, any> {
|
|
|
|
|
private readonly setFocusBound: () => void;
|
|
|
|
|
private readonly inputRef: React.RefObject<HTMLInputElement>;
|
|
|
|
|
private readonly debouncedSearch: (searchTerm: string) => void;
|
|
|
|
|
private readonly timerId: any;
|
|
|
|
|
|
|
|
|
|
constructor(props: Props) {
|
|
|
|
|
super(props);
|
|
|
|
@ -92,9 +93,11 @@ export class MainHeader extends React.Component<Props, any> {
|
|
|
|
|
|
|
|
|
|
this.debouncedSearch = debounce(this.search.bind(this), 20);
|
|
|
|
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
|
this.timerId = setInterval(() => {
|
|
|
|
|
const clipboardText = clipboard.readText();
|
|
|
|
|
this.setState({ clipboardText });
|
|
|
|
|
if (this.state.clipboardText !== clipboardText) {
|
|
|
|
|
this.setState({ clipboardText });
|
|
|
|
|
}
|
|
|
|
|
}, 100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -103,6 +106,11 @@ export class MainHeader extends React.Component<Props, any> {
|
|
|
|
|
this.updateHasPass();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public componentWillUnmount() {
|
|
|
|
|
// tslint:disable-next-line
|
|
|
|
|
clearInterval(this.timerId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public componentDidUpdate(_prevProps: Props, prevState: any) {
|
|
|
|
|
if (prevState.hasPass !== this.state.hasPass) {
|
|
|
|
|
this.updateMenuItems();
|
|
|
|
|