aboutsummaryrefslogtreecommitdiff
path: root/ext/js/templates/template-renderer-frame-api.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/templates/template-renderer-frame-api.js')
-rw-r--r--ext/js/templates/template-renderer-frame-api.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/js/templates/template-renderer-frame-api.js b/ext/js/templates/template-renderer-frame-api.js
index dd6be517..f234c8e0 100644
--- a/ext/js/templates/template-renderer-frame-api.js
+++ b/ext/js/templates/template-renderer-frame-api.js
@@ -27,6 +27,7 @@ class TemplateRendererFrameApi {
prepare() {
window.addEventListener('message', this._onWindowMessage.bind(this), false);
+ this._postMessage(window.parent, 'ready', {}, null);
}
// Private
@@ -52,7 +53,7 @@ class TemplateRendererFrameApi {
}
if (typeof id === 'undefined') { return; }
- source.postMessage({action: `${action}.response`, params: response, id}, '*');
+ this._postMessage(source, `${action}.response`, response, id);
}
_onRender({template, data, type}) {
@@ -101,4 +102,8 @@ class TemplateRendererFrameApi {
_clone(value) {
return JSON.parse(JSON.stringify(value));
}
+
+ _postMessage(target, action, params, id) {
+ return target.postMessage({action, params, id}, '*');
+ }
}