Fix wanakana.unbind throwing an error (#1422)
This commit is contained in:
parent
19d0d5b512
commit
6a6d7ba84e
@ -33,6 +33,7 @@ class SearchDisplayController {
|
|||||||
this._queryInputEvents = new EventListenerCollection();
|
this._queryInputEvents = new EventListenerCollection();
|
||||||
this._queryInputEventsSetup = false;
|
this._queryInputEventsSetup = false;
|
||||||
this._wanakanaEnabled = false;
|
this._wanakanaEnabled = false;
|
||||||
|
this._wanakanaBound = false;
|
||||||
this._introVisible = true;
|
this._introVisible = true;
|
||||||
this._introAnimationTimer = null;
|
this._introAnimationTimer = null;
|
||||||
this._clipboardMonitorEnabled = false;
|
this._clipboardMonitorEnabled = false;
|
||||||
@ -223,9 +224,15 @@ class SearchDisplayController {
|
|||||||
|
|
||||||
this._wanakanaEnabled = enabled;
|
this._wanakanaEnabled = enabled;
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
|
if (!this._wanakanaBound) {
|
||||||
wanakana.bind(input);
|
wanakana.bind(input);
|
||||||
|
this._wanakanaBound = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (this._wanakanaBound) {
|
||||||
wanakana.unbind(input);
|
wanakana.unbind(input);
|
||||||
|
this._wanakanaBound = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this._queryInputEvents.addEventListener(input, 'input', this._onSearchInput.bind(this), false);
|
this._queryInputEvents.addEventListener(input, 'input', this._onSearchInput.bind(this), false);
|
||||||
|
Loading…
Reference in New Issue
Block a user