aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/search-query-parser.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-24 13:30:40 -0400
committerGitHub <noreply@github.com>2020-05-24 13:30:40 -0400
commitc61a87b152b91bdebe01eefdbc3fa00670a3071d (patch)
tree63a94eacdc437da1e166a72a9b4d4794df294f22 /ext/bg/js/search-query-parser.js
parent83a577fa569e5a6d468e3b304313106bba3e1e49 (diff)
API refactor (#532)
* Convert api.js into a class instance * Use new api.* functions * Fix missing binds * Group functions with progress callbacks together * Change style * Fix API override not working
Diffstat (limited to 'ext/bg/js/search-query-parser.js')
-rw-r--r--ext/bg/js/search-query-parser.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/ext/bg/js/search-query-parser.js b/ext/bg/js/search-query-parser.js
index e1e37d1c..addfc686 100644
--- a/ext/bg/js/search-query-parser.js
+++ b/ext/bg/js/search-query-parser.js
@@ -18,9 +18,7 @@
/* global
* QueryParserGenerator
* TextScanner
- * apiModifySettings
- * apiTermsFind
- * apiTextParse
+ * api
* docSentenceExtract
*/
@@ -59,7 +57,7 @@ class QueryParser {
this._setPreview(text);
- this._parseResults = await apiTextParse(text, this._getOptionsContext());
+ this._parseResults = await api.textParse(text, this._getOptionsContext());
this._refreshSelectedParser();
this._renderParserSelect();
@@ -80,7 +78,7 @@ class QueryParser {
const searchText = this._textScanner.getTextSourceContent(textSource, this._options.scanning.length);
if (searchText.length === 0) { return null; }
- const {definitions, length} = await apiTermsFind(searchText, {}, this._getOptionsContext());
+ const {definitions, length} = await api.termsFind(searchText, {}, this._getOptionsContext());
if (definitions.length === 0) { return null; }
const sentence = docSentenceExtract(textSource, this._options.anki.sentenceExt);
@@ -99,7 +97,7 @@ class QueryParser {
_onParserChange(e) {
const value = e.target.value;
- apiModifySettings([{
+ api.modifySettings([{
action: 'set',
path: 'parsing.selectedParser',
value,
@@ -112,7 +110,7 @@ class QueryParser {
if (this._parseResults.length > 0) {
if (!this._getParseResult()) {
const value = this._parseResults[0].id;
- apiModifySettings([{
+ api.modifySettings([{
action: 'set',
path: 'parsing.selectedParser',
value,