From fd00a5285651313ce96f7fd00078c4bc72c00eb2 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 21 May 2022 15:28:44 -0400 Subject: Anki findNotes (#2152) * Add findNotes API * Add api.findAnkiNotes --- ext/js/background/backend.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ext/js/background/backend.js') diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js index 66f80351..b25b6033 100644 --- a/ext/js/background/backend.js +++ b/ext/js/background/backend.js @@ -129,7 +129,8 @@ class Backend { ['triggerDatabaseUpdated', {async: false, contentScript: true, handler: this._onApiTriggerDatabaseUpdated.bind(this)}], ['testMecab', {async: true, contentScript: true, handler: this._onApiTestMecab.bind(this)}], ['textHasJapaneseCharacters', {async: false, contentScript: true, handler: this._onApiTextHasJapaneseCharacters.bind(this)}], - ['getTermFrequencies', {async: true, contentScript: true, handler: this._onApiGetTermFrequencies.bind(this)}] + ['getTermFrequencies', {async: true, contentScript: true, handler: this._onApiGetTermFrequencies.bind(this)}], + ['findAnkiNotes', {async: true, contentScript: true, handler: this._onApiFindAnkiNotes.bind(this)}] ]); this._messageHandlersWithProgress = new Map([ ]); @@ -752,6 +753,10 @@ class Backend { return await this._translator.getTermFrequencies(termReadingList, dictionaries); } + async _onApiFindAnkiNotes({query}) { + return await this._anki.findNotes(query); + } + // Command handlers async _onCommandOpenSearchPage(params) { -- cgit v1.2.3