I have really small project with single .html file and one .js file. The problem that I used asyn/await functions so I need to convert it to es5 to be sure that everything works fine.
So, my .html file looks like this:
<html>
<head>
</head>
<body>
...//page markup
<script src="dist/myCodeAsES5.js"></script>
<script>
var obj = new MyClass();
obj.calculate();
</script>
</body>
</html>
And here my src.js
class MyClass{
constructor(){
this.calculate = async function () {
await func1();
}
}
async function func1() {
for (var i = 0; i < 3; i++) {
await func2(); // await in loop until func2() completed
}
}
async function func2() {
for (var i = 0; i < 10; i++) {
await func3(); //wait until func3 and then continue looping
}
}
function func3() {
return new Promise(resolve => setTimeout(resolve, 1000));
}
}
Now the main question- how to convert it to es5 so it can be 100% woks in Internet Explorer. I had read a lot about "babel" but everything that I found is not understandable or out of date. So can somebody write a short step-by-step guide how to install and compile that small project?