diff options
Diffstat (limited to 'ext/js/templates/template-renderer-frame-api.js')
-rw-r--r-- | ext/js/templates/template-renderer-frame-api.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ext/js/templates/template-renderer-frame-api.js b/ext/js/templates/template-renderer-frame-api.js index 4936a2af..6eebc199 100644 --- a/ext/js/templates/template-renderer-frame-api.js +++ b/ext/js/templates/template-renderer-frame-api.js @@ -19,7 +19,8 @@ class TemplateRendererFrameApi { constructor(templateRenderer) { this._templateRenderer = templateRenderer; this._windowMessageHandlers = new Map([ - ['render', {async: true, handler: this._onRender.bind(this)}] + ['render', {async: true, handler: this._onRender.bind(this)}], + ['getModifiedData', {async: true, handler: this._onGetModifiedData.bind(this)}] ]); } @@ -57,6 +58,11 @@ class TemplateRendererFrameApi { return await this._templateRenderer.render(template, data, type); } + async _onGetModifiedData({data, type}) { + const result = await this._templateRenderer.getModifiedData(data, type); + return this._clone(result); + } + _errorToJson(error) { try { if (error !== null && typeof error === 'object') { @@ -75,4 +81,8 @@ class TemplateRendererFrameApi { hasValue: true }; } + + _clone(value) { + return JSON.parse(JSON.stringify(value)); + } } |