Skip to content

Commit

Permalink
Isolate Handlebars environment
Browse files Browse the repository at this point in the history
  • Loading branch information
ursm committed Jan 18, 2019
1 parent a08e678 commit 057efdd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions provider/assets-src/js/stanza.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ export default function Stanza(execute) {
}

function createStanzaHelper(element) {
const handlebars = Handlebars.create();

return {
root: element.shadowRoot,
handlebars,

query(params) {
if (development) {
console.log("query: called", params);
}
const t = template(params.template);
const queryTemplate = Handlebars.compile(t, {noEscape: true});
const queryTemplate = handlebars.compile(t, {noEscape: true});
const query = queryTemplate(params.parameters);
const data = new URLSearchParams();
data.set("query", query);
Expand Down Expand Up @@ -53,7 +56,7 @@ export default function Stanza(execute) {
}

const t = template(params.template);
const htmlTemplate = Handlebars.compile(t);
const htmlTemplate = handlebars.compile(t);
const htmlFragment = htmlTemplate(params.parameters);

if (development) {
Expand Down

0 comments on commit 057efdd

Please sign in to comment.