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-05 19:34:31 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-04-07 19:04:47 -0400
commit8a419dfa67b730d777fbefaf9c6ffa649bbb67d3 (patch)
tree29750a1f335084a670d180a9edd4a40103b168da /ext/bg/js/anki-note-builder.js
parent716ab99fc04e0a02e24d3de20cdf0d3a368c1bf0 (diff)
Pass AudioSystem instance to AnkiNoteBuilder constructor
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 0e17783b..1ccec20c 100644
--- a/ext/bg/js/anki-note-builder.js
+++ b/ext/bg/js/anki-note-builder.js
@@ -17,7 +17,8 @@
*/
class AnkiNoteBuilder {
- constructor({renderTemplate}) {
+ constructor({audioSystem, renderTemplate}) {
+ this._audioSystem = audioSystem;
this._renderTemplate = renderTemplate;
}
@@ -84,14 +85,14 @@ class AnkiNoteBuilder {
});
}
- async injectAudio(definition, fields, sources, audioSystem, optionsContext) {
+ async injectAudio(definition, fields, sources, optionsContext) {
if (!this._containsMarker(fields, 'audio')) { return; }
try {
const expressions = definition.expressions;
const audioSourceDefinition = Array.isArray(expressions) ? expressions[0] : definition;
- const {uri} = await audioSystem.getDefinitionAudio(audioSourceDefinition, sources, {tts: false, optionsContext});
+ const {uri} = await this.audioSystem.getDefinitionAudio(audioSourceDefinition, sources, {tts: false, optionsContext});
const filename = this._createInjectedAudioFileName(audioSourceDefinition);
if (filename !== null) {
definition.audio = {url: uri, filename};