summaryrefslogtreecommitdiff
path: root/ext/bg/js/api.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/api.js')
-rw-r--r--ext/bg/js/api.js22
1 files changed, 2 insertions, 20 deletions
diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js
index 6ab130a7..5c1aebb6 100644
--- a/ext/bg/js/api.js
+++ b/ext/bg/js/api.js
@@ -100,27 +100,9 @@ async function apiNoteView(noteId) {
async function apiTemplateRender(template, data, dynamic) {
if (dynamic) {
- return new Promise((resolve, reject) => {
- const sequence = utilBackend().sequenceNew();
- const handler = event => {
- if (event.data.sequence === sequence) {
- if (event.data.command === 'error') {
- reject(event.data.result);
- } else {
- resolve(event.data.result);
- }
-
- window.removeEventListener('message', handler);
- }
- };
-
- window.addEventListener('message', handler);
-
- const sandbox = utilBackend().sandbox();
- sandbox.postMessage({template, data, sequence, command: 'render'}, '*');
- });
+ return handlebarsRenderDynamic(template, data);
} else {
- return handlebarsRender(template, data);
+ return handlebarsRenderStatic(template, data);
}
}