Skip to content

Instantly share code, notes, and snippets.

@matthewrobb
Created June 27, 2014 15:05
Show Gist options
  • Save matthewrobb/7685866134d1ee8366b1 to your computer and use it in GitHub Desktop.
Save matthewrobb/7685866134d1ee8366b1 to your computer and use it in GitHub Desktop.
Async YUI Micro Templates
require(traceur.RUNTIME_PATH);
function compile() {
var tpl = Micro.precompile("ello <%= govna %>") + "";
tpl = [
"(async function() {",
tpl.slice(tpl.indexOf("{") + 1, tpl.length - 1),
"})();"
].join("\n");
tpl = traceur.compile(tpl, {
modules : "commonjs",
asyncFunctions : true
});
tpl = vm.createScript(tpl.js);
tpl.runInNewContext({
$traceurRuntime: global.$traceurRuntime,
govna:"quimby",
$e:function(v) { return v; }
}).then(function(result) {
console.log(result) // ello quimby
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment