WIP
This commit is contained in:
parent
3fa393354b
commit
b3e4137340
@ -163,21 +163,27 @@ class Yomichan {
|
|||||||
|
|
||||||
api_findKanji({text, callback}) {
|
api_findKanji({text, callback}) {
|
||||||
promiseCallback(
|
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
|
callback
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
api_findTerms({text, callback}) {
|
api_findTerms({text, callback}) {
|
||||||
promiseCallback(
|
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
|
callback
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
api_findTermsGrouped({text, callback}) {
|
api_findTermsGrouped({text, callback}) {
|
||||||
promiseCallback(
|
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
|
callback
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user