diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-03-07 15:20:45 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-03-07 21:47:48 -0500 |
commit | 7ac1c843a92cbefd0a625f06b5093217b585f7cf (patch) | |
tree | 291abdc5aaa3e9347676c1aa452192ddc8184c0d /ext/bg/js/anki-note-builder.js | |
parent | 69cce49b0d5d9f11f4ffb529ae3d060536297c07 (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.js | 7 |
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}`; |