aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/api.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-09-09 12:59:49 -0700
committerAlex Yatskov <alex@foosoft.net>2017-09-09 12:59:49 -0700
commit5f46006e8da1d51a66291f25a2bc75959ec81efd (patch)
tree1a0b4d7948273ae95f8517cd77fc6d9e008f0f05 /ext/bg/js/api.js
parent9a5a9aa47fd9a6c7ea6830a821689321e8fd9fbb (diff)
scrap sandbox
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);
}
}