Last active
March 20, 2017 19:35
-
-
Save mlrawlings/8b67bee58df45709e232f689b873e1d1 to your computer and use it in GitHub Desktop.
Marko v4 Multiple Compilation Targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
function render(data, out, widget, state) { | |
out.w("<div" + | |
marko_styleAttr(styles.container) + | |
marko_attr("id", widget.id) + | |
"><h2>Marko Banner: </h2><div" + | |
marko_styleAttr(styles.list) + | |
">"); | |
marko_forEachProp(data.items, function(idx, item) { | |
out.w("<div" + | |
marko_styleAttr(styles.item) + | |
marko_attr("data-_onclick", markoWidgets_event("onBannerClick", widget.id, [ | |
item.title | |
])) + | |
"><img" + | |
marko_attr("src", item.img) + | |
marko_styleAttr(styles.itemImg) + | |
"></div>"); | |
}); | |
out.w("</div></div>"); | |
} | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
function render(data, out, widget, state) { | |
out.be("div", { | |
style: marko_styleAttr(styles.container), | |
id: widget.id | |
}); | |
out.n(marko_node0); | |
out.be("div", { | |
style: marko_styleAttr(styles.list) | |
}); | |
marko_forEachProp(data.items, function(idx, item) { | |
out.e("div", { | |
style: marko_styleAttr(styles.item), | |
"data-_onclick": markoWidgets_event("onBannerClick", widget.id, [ | |
item.title | |
]) | |
}, 1) | |
.e("img", { | |
src: item.img, | |
style: marko_styleAttr(styles.itemImg) | |
}, 0); | |
}); | |
out.ee(); | |
out.ee(); | |
} | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment