Skip to content

Commit

Permalink
Merge pull request #53 from togostanza/handlebars
Browse files Browse the repository at this point in the history
Isolate Handlebars environment
  • Loading branch information
darashi authored Jan 23, 2019
2 parents a08e678 + 057efdd commit 8ccd589
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 8ccd589

Please sign in to comment.