summaryrefslogtreecommitdiff
path: root/ext/bg/js/anki-note-builder.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-03-07 15:20:45 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-03-07 21:47:48 -0500
commit7ac1c843a92cbefd0a625f06b5093217b585f7cf (patch)
tree291abdc5aaa3e9347676c1aa452192ddc8184c0d /ext/bg/js/anki-note-builder.js
parent69cce49b0d5d9f11f4ffb529ae3d060536297c07 (diff)
Use dependency injection for apiTemplateRender
Diffstat (limited to 'ext/bg/js/anki-note-builder.js')
-rw-r--r--ext/bg/js/anki-note-builder.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/bg/js/anki-note-builder.js b/ext/bg/js/anki-note-builder.js
index f7555280..be39ff43 100644
--- a/ext/bg/js/anki-note-builder.js
+++ b/ext/bg/js/anki-note-builder.js
@@ -16,10 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/*global apiTemplateRender*/
-
class AnkiNoteBuilder {
- constructor() {
+ constructor({renderTemplate}) {
+ this._renderTemplate = renderTemplate;
this._markers = new Set([
'audio',
'character',
@@ -100,7 +99,7 @@ class AnkiNoteBuilder {
}
data.marker = marker;
try {
- return await apiTemplateRender(templates, data);
+ return await this._renderTemplate(templates, data);
} catch (e) {
if (errors) { errors.push(e); }
return `{${marker}-render-error}`;