aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-01-27 19:43:45 -0800
committerAlex Yatskov <alex@foosoft.net>2017-01-27 19:43:45 -0800
commitb3e4137340ef21b9be816d87ea1987e9ced80781 (patch)
tree8d97e32c24488fe7894afc63b99dc208e70a1d87
parent3fa393354b90cee5a349ab813889fe2d8cd59289 (diff)
WIP
-rw-r--r--ext/bg/js/yomichan.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js
index 720c450a..f6b1e611 100644
--- a/ext/bg/js/yomichan.js
+++ b/ext/bg/js/yomichan.js
@@ -163,21 +163,27 @@ class Yomichan {
api_findKanji({text, callback}) {
promiseCallback(
- this.translator.findKanji(text, enabledDicts(this.options)),
+ this.translator.findKanji(text, enabledDicts(this.options)).then(definitions => {
+ return definitions.slice(0, this.options.general.maxResults);
+ }),
callback
);
}
api_findTerms({text, callback}) {
promiseCallback(
- this.translator.findTerms(text, enabledDicts(this.options), this.options.general.softKatakana),
+ this.translator.findTerms(text, enabledDicts(this.options), this.options.general.softKatakana).then(({definitions, length}) => {
+ return {length, definitions: definitions.slice(0, this.options.general.maxResults)};
+ }),
callback
);
}
api_findTermsGrouped({text, callback}) {
promiseCallback(
- this.translator.findTermsGrouped(text, enabledDicts(this.options), this.options.general.softKatakana),
+ this.translator.findTermsGrouped(text, enabledDicts(this.options), this.options.general.softKatakana).then(({definitions, length}) => {
+ return {length, definitions: definitions.slice(0, this.options.general.maxResults)};
+ }),
callback
);
}