Skip to content

Instantly share code, notes, and snippets.

@matobaa
Last active March 6, 2019 14:26
Show Gist options
  • Save matobaa/076c2724817fcdd4465acebc1b530dde to your computer and use it in GitHub Desktop.
Save matobaa/076c2724817fcdd4465acebc1b530dde to your computer and use it in GitHub Desktop.
async/await in IE with babel
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.26.0/polyfill.js"></script>
</head>
<body>
<div id="output"></div>
</body>
<script type="text/babel" data-presets="es2015,stage-3">
const getMessage = () => "Hello World";
document.getElementById('output').innerHTML = getMessage();
const p = () => {
return new Promise(resolve => {
setTimeout( () => resolve("1000") , 1000);
})
};
async function q() {
document.getElementById('output').innerHTML = await p()
}
q()
</script>
</html>
@matobaa
Copy link
Author

matobaa commented Mar 6, 2019

not works with

<script src="https://unpkg.com/@babel/polyfill/browser.js"></script>  <!-- 7.2.5 -->
<script src="https://unpkg.com/@babel/standalone/babel.js"></script>  <!-- 7.3.4 -->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment