convert manual bind to arrow

This commit is contained in:
Labhansh Agrawal 2019-11-25 21:46:00 +05:30 committed by Benjamin Staneck
parent ac782f382b
commit 4e0fc48ec6
11 changed files with 62 additions and 99 deletions

View file

@ -21,10 +21,6 @@ class Hyper extends React.PureComponent<any, any> {
terms: any;
constructor(props: any) {
super(props);
this.handleFocusActive = this.handleFocusActive.bind(this);
this.handleSelectAll = this.handleSelectAll.bind(this);
this.onTermsRef = this.onTermsRef.bind(this);
this.state = {
lastConfigUpdate: 0
};
@ -43,19 +39,19 @@ class Hyper extends React.PureComponent<any, any> {
}
}
handleFocusActive(uid: string) {
handleFocusActive = (uid: string) => {
const term = this.terms.getTermByUid(uid);
if (term) {
term.focus();
}
}
};
handleSelectAll() {
handleSelectAll = () => {
const term = this.terms.getActiveTerm();
if (term) {
term.selectAll();
}
}
};
attachKeyListeners() {
if (!this.mousetrap) {
@ -89,10 +85,10 @@ class Hyper extends React.PureComponent<any, any> {
window.rpc.on('term selectAll', this.handleSelectAll);
}
onTermsRef(terms: any) {
onTermsRef = (terms: any) => {
this.terms = terms;
window.focusActiveTerm = this.handleFocusActive;
}
};
componentDidUpdate(prev: any) {
if (prev.activeSession !== this.props.activeSession) {