Move apiTermsFind implementation into Backend
This commit is contained in:
parent
5cceba15e2
commit
73ce2fe3d3
@ -33,11 +33,8 @@ function apiOptionsSave(source) {
|
|||||||
return utilBackend()._onApiOptionsSave({source});
|
return utilBackend()._onApiOptionsSave({source});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function apiTermsFind(text, details, optionsContext) {
|
function apiTermsFind(text, details, optionsContext) {
|
||||||
const options = await apiOptionsGet(optionsContext);
|
return utilBackend()._onApiTermsFind({text, details, optionsContext});
|
||||||
const [definitions, length] = await utilBackend().translator.findTerms(text, details, options);
|
|
||||||
definitions.splice(options.general.maxResults);
|
|
||||||
return {length, definitions};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function apiTextParse(text, optionsContext) {
|
async function apiTextParse(text, optionsContext) {
|
||||||
|
@ -247,8 +247,11 @@ class Backend {
|
|||||||
return definitions;
|
return definitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
_onApiTermsFind({text, details, optionsContext}) {
|
async _onApiTermsFind({text, details, optionsContext}) {
|
||||||
return apiTermsFind(text, details, optionsContext);
|
const options = await this.getOptions(optionsContext);
|
||||||
|
const [definitions, length] = await this.translator.findTerms(text, details, options);
|
||||||
|
definitions.splice(options.general.maxResults);
|
||||||
|
return {length, definitions};
|
||||||
}
|
}
|
||||||
|
|
||||||
_onApiTextParse({text, optionsContext}) {
|
_onApiTextParse({text, optionsContext}) {
|
||||||
|
Loading…
Reference in New Issue
Block a user