Hi,
I'm trying to transpile the JS file on-the-fly. But it results in (ReferenceError: webLoader is not defined)
Here is my html code.
<!DOCTYPE html>
<html>
<head>
<title>Testing ES6</title>
<script>
$traceurRuntime.options = traceur.util.Options.experimental();
</script>
<script type="module" src="JSToday.js"></script>
</head>
<body>
Experimenting ES6 features!!!
</body>
</html>
Javascript file "JSToday.js"
// Starts Here --
async function myGen()
{
console.log("myGen started!");
await timeout(2000);
console.log("myGen completed after 2000 ms!");
}
function timeout(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
(function Body_OnLoad() {
myGen();
})();
// Ends Here --
Error in Console:
traceur.js:31136 Uncaught ReferenceError: webLoader is not defined
Note:
If I move the content of JSToday.js file into a script tag in the html file, then it works fine.
Thanks,
Karthik
.
.