summaryrefslogtreecommitdiff
path: root/ext/bg/js/anki-note-builder.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-04-18 14:14:52 -0400
committerGitHub <noreply@github.com>2020-04-18 14:14:52 -0400
commit5b3d7fadc3534ba27eee971dac4ba5ee475c4e3d (patch)
tree5af68163c940fc272563e6759e3996206a33e32a /ext/bg/js/anki-note-builder.js
parent9297eb45aef3bad50fe9cf5e453aa97288609601 (diff)
parent06e95b8747e7222d3aa513cda28b0878a11921d9 (diff)
Merge pull request #453 from toasted-nutbread/reuse-anki-instance
Reuse AnkiConnect instance
Diffstat (limited to 'ext/bg/js/anki-note-builder.js')
-rw-r--r--ext/bg/js/anki-note-builder.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/bg/js/anki-note-builder.js b/ext/bg/js/anki-note-builder.js
index 8a707006..700d8237 100644
--- a/ext/bg/js/anki-note-builder.js
+++ b/ext/bg/js/anki-note-builder.js
@@ -16,7 +16,8 @@
*/
class AnkiNoteBuilder {
- constructor({audioSystem, renderTemplate}) {
+ constructor({anki, audioSystem, renderTemplate}) {
+ this._anki = anki;
this._audioSystem = audioSystem;
this._renderTemplate = renderTemplate;
}
@@ -101,7 +102,7 @@ class AnkiNoteBuilder {
}
}
- async injectScreenshot(definition, fields, screenshot, anki) {
+ async injectScreenshot(definition, fields, screenshot) {
if (!this._containsMarker(fields, 'screenshot')) { return; }
const now = new Date(Date.now());
@@ -109,7 +110,7 @@ class AnkiNoteBuilder {
const data = screenshot.dataUrl.replace(/^data:[\w\W]*?,/, '');
try {
- await anki.storeMediaFile(filename, data);
+ await this._anki.storeMediaFile(filename, data);
} catch (e) {
return;
}