summaryrefslogtreecommitdiff
path: root/ext/bg/js/display-window.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-07-29 09:55:54 -0700
committerAlex Yatskov <alex@foosoft.net>2017-07-29 09:55:54 -0700
commitb061cc914210e6c11bc419c38ec850b59d72dd4d (patch)
tree2fa3493fb4a8273a12dee3ddb315da46e36eb1b5 /ext/bg/js/display-window.js
parentfea35435b22a4eeadbfcc5f29d5f9518700d4306 (diff)
cleanup
Diffstat (limited to 'ext/bg/js/display-window.js')
-rw-r--r--ext/bg/js/display-window.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/ext/bg/js/display-window.js b/ext/bg/js/display-window.js
index e5357bf9..1f607510 100644
--- a/ext/bg/js/display-window.js
+++ b/ext/bg/js/display-window.js
@@ -37,11 +37,15 @@ window.displayWindow = new class extends Display {
$('#query').focus().select();
}
- onSearch(e) {
+ async onSearch(e) {
e.preventDefault();
- $('#intro').slideUp();
- instYomi().termsFind($('#query').val()).then(({length, definitions}) => {
- super.showTermDefs(definitions, instYomi().options);
- }).catch(this.handleError.bind(this));
+
+ try {
+ $('#intro').slideUp();
+ const {length, definitions} = await apiTermsFind($('#query').val());
+ super.showTermDefs(definitions, await apiOptionsGet());
+ } catch (e) {
+ this.handleError(e);
+ }
}
};