Skip to content

Avoid top lvl await in page init #97

@hsn10

Description

@hsn10

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions