Last active
March 6, 2019 14:26
-
-
Save matobaa/076c2724817fcdd4465acebc1b530dde to your computer and use it in GitHub Desktop.
async/await in IE with babel
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
<!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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not works with