aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-02-19 18:39:36 -0500
committerGitHub <noreply@github.com>2021-02-19 18:39:36 -0500
commit6a6d7ba84e778d1e5917f905748fe752a8712016 (patch)
treed4207a2f16ff3070f88886f54d11c2c1a36fcb77
parent19d0d5b5121e1b5d1bf939151d1e118ec5b168ab (diff)
Fix wanakana.unbind throwing an error (#1422)
-rw-r--r--ext/js/display/search-display-controller.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/js/display/search-display-controller.js b/ext/js/display/search-display-controller.js
index d1a4593f..c8025d62 100644
--- a/ext/js/display/search-display-controller.js
+++ b/ext/js/display/search-display-controller.js
@@ -33,6 +33,7 @@ class SearchDisplayController {
this._queryInputEvents = new EventListenerCollection();
this._queryInputEventsSetup = false;
this._wanakanaEnabled = false;
+ this._wanakanaBound = false;
this._introVisible = true;
this._introAnimationTimer = null;
this._clipboardMonitorEnabled = false;
@@ -223,9 +224,15 @@ class SearchDisplayController {
this._wanakanaEnabled = enabled;
if (enabled) {
- wanakana.bind(input);
+ if (!this._wanakanaBound) {
+ wanakana.bind(input);
+ this._wanakanaBound = true;
+ }
} else {
- wanakana.unbind(input);
+ if (this._wanakanaBound) {
+ wanakana.unbind(input);
+ this._wanakanaBound = true;
+ }
}
this._queryInputEvents.addEventListener(input, 'input', this._onSearchInput.bind(this), false);