perf(): prevent unnecesary event listener changes

This commit is contained in:
Manu Mtz.-Almeida
2018-10-09 16:03:14 -05:00
parent 545db2e4c4
commit a999c1f0a9
9 changed files with 82 additions and 86 deletions

View File

@ -108,20 +108,20 @@ export class Button implements ComponentInterface {
}
}
private onFocus() {
private onFocus = () => {
this.ionFocus.emit();
}
private onKeyUp() {
private onKeyUp = () => {
this.keyFocus = true;
}
private onBlur() {
private onBlur = () => {
this.keyFocus = false;
this.ionBlur.emit();
}
private onClick(ev: Event) {
private onClick = (ev: Event) => {
if (this.type === 'button') {
return openURL(this.win, this.href, ev, this.routerDirection);
@ -177,10 +177,10 @@ export class Button implements ComponentInterface {
{...attrs}
class="button-native"
disabled={this.disabled}
onFocus={this.onFocus.bind(this)}
onKeyUp={this.onKeyUp.bind(this)}
onBlur={this.onBlur.bind(this)}
onClick={this.onClick.bind(this)}
onFocus={this.onFocus}
onKeyUp={this.onKeyUp}
onBlur={this.onBlur}
onClick={this.onClick}
>
<span class="button-inner">
<slot name="icon-only"></slot>