sauron
sauron copied to clipboard
Avoid top lvl await in page init
More compatible init code because older browsers do not have top level await. Solves problems with mobile users which can't update. Seems like this JS feature landed in 2021.
https://caniuse.com/mdn-javascript_operators_await_top_level
<script type=module>
import init from './pkg/counter.js';
init().then(() => {
console.log('Module initialized successfully');
}).catch(console.error);
</script>