diff options
Diffstat (limited to 'ext/bg/js/template-renderer-frame-api.js')
-rw-r--r-- | ext/bg/js/template-renderer-frame-api.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/bg/js/template-renderer-frame-api.js b/ext/bg/js/template-renderer-frame-api.js index ecdc7268..4936a2af 100644 --- a/ext/bg/js/template-renderer-frame-api.js +++ b/ext/bg/js/template-renderer-frame-api.js @@ -19,7 +19,7 @@ class TemplateRendererFrameApi { constructor(templateRenderer) { this._templateRenderer = templateRenderer; this._windowMessageHandlers = new Map([ - ['renderHandlebarsTemplate', {async: true, handler: this._onRenderHandlebarsTemplate.bind(this)}] + ['render', {async: true, handler: this._onRender.bind(this)}] ]); } @@ -27,6 +27,8 @@ class TemplateRendererFrameApi { window.addEventListener('message', this._onWindowMessage.bind(this), false); } + // Private + _onWindowMessage(e) { const {source, data: {action, params, id}} = e; const messageHandler = this._windowMessageHandlers.get(action); @@ -51,8 +53,8 @@ class TemplateRendererFrameApi { source.postMessage({action: `${action}.response`, params: response, id}, '*'); } - async _onRenderHandlebarsTemplate({template, data, marker}) { - return await this._templateRenderer.render(template, data, marker); + async _onRender({template, data, type}) { + return await this._templateRenderer.render(template, data, type); } _errorToJson(error) { |