Last active
May 11, 2023 15:09
-
-
Save DejanBelic/d3b8a008049cd160941f391d326cdaab to your computer and use it in GitHub Desktop.
How to use async await in ie11
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
// Async await func | |
async function getTimelineData() { | |
var response = await fetch('/some-api-url') | |
return response.json() | |
} | |
async function populateTimelineInit() { | |
var data = await getTimelineData(); | |
new vis.DataSet(data); | |
} | |
populateTimelineInit(); | |
// First we transpile code above: https://babeljs.io/repl/ | |
/* After that we have to include 3 polyfills but before code is executed. So beside annoying code regenerator | |
which is required for async await to work, we also need promise and fetch polyfill. | |
https://cdn.jsdelivr.net/npm/[email protected]/runtime.js: | |
https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js: | |
https://cdnjs.cloudflare.com/ajax/libs/fetch/2.0.3/fetch.js: | |
That's all it's needed :) */ |
@houyaowei I think this is not a question, it's explanation how to do it in IE11 :)
@houyaowei I think this is not a question, it's explanation how to do it in IE11 :)
🤣🤣🤣
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this feature is not support in ie11
https://caniuse.com/#search=async