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

@ -99,19 +99,19 @@ export class Checkbox implements ComponentInterface {
});
}
private onChange() {
private onChange = () => {
this.checked = !this.checked;
}
private onKeyUp() {
private onKeyUp = () => {
this.keyFocus = true;
}
private onFocus() {
private onFocus = () => {
this.ionFocus.emit();
}
private onBlur() {
private onBlur = () => {
this.keyFocus = false;
this.ionBlur.emit();
}
@ -140,10 +140,10 @@ export class Checkbox implements ComponentInterface {
type="checkbox"
id={this.inputId}
aria-labelledby={this.labelId}
onChange={this.onChange.bind(this)}
onFocus={this.onFocus.bind(this)}
onBlur={this.onBlur.bind(this)}
onKeyUp={this.onKeyUp.bind(this)}
onChange={this.onChange}
onFocus={this.onFocus}
onBlur={this.onBlur}
onKeyUp={this.onKeyUp}
checked={this.checked}
name={this.name}
value={this.value}