Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid top lvl await in page init #97

Open
hsn10 opened this issue May 9, 2024 · 0 comments
Open

Avoid top lvl await in page init #97

hsn10 opened this issue May 9, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@hsn10
Copy link

hsn10 commented May 9, 2024

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>

@ivanceras ivanceras added the enhancement New feature or request label Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants