Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Defaulting to async for top-level await #2134

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

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

WebReflection
Copy link
Contributor

Description

We have been discussing about making our code always asynchronous so that there are less attributes to type, latest named workers would work out of the box and so it would the storage. The amount of things that need async attribute is just growing so it's about the time to just make it work while keeping it simpler than before.

The previously used async attribute won't be affected by this change while scripts that needs to be synchronous can now use async="false" ... where false can be also 0 or no or False.

This MR has been published already as @pyscript/core@next on npm so it's possible to test it already via the following URLs:

  • JS https://cdn.jsdelivr.net/npm/@pyscript/core@next/dist/core.js
  • CSS https://cdn.jsdelivr.net/npm/@pyscript/core@next/dist/core.css

It would be lovely to understand if current projects based on PyScript default sync behavior would have any issue here ... /cc @ntoll @mchilvers @laffra @JeffersGlass

Changes

  • use the new exported utility to determinate if a script is asynchronous or forced synchronous
  • added tests to verify by default everything is fine
  • changed tests to force synchronous behavior to be sure integration tests give us expected results

Checklist

  • All tests pass locally
  • I have updated CHANGELOG.md
  • I have created documentation for this(if applicable)

@WebReflection WebReflection requested a review from ntoll August 1, 2024 08:01
@WebReflection WebReflection force-pushed the async-by-default branch 5 times, most recently from abaf24c to e6138ec Compare August 5, 2024 12:03
Copy link
Member

@ntoll ntoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@WebReflection WebReflection merged commit 0d0ea96 into pyscript:main Aug 5, 2024
2 checks passed
iliketocode2 referenced this pull request in iliketocode2/Lego-Spike-AI-Labyrinth Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants