sauron icon indicating copy to clipboard operation
sauron copied to clipboard

Avoid top lvl await in page init

Open hsn10 opened this issue 1 year ago • 0 comments

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>

hsn10 avatar May 09 '24 13:05 hsn10