Skip to content

#113: Add JS platform support #204

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

Closed
wants to merge 17 commits into from

Conversation

maik-mursall
Copy link

@maik-mursall maik-mursall commented Nov 22, 2023

Implementation of #113

  • Added JS build target (node & browser)
  • Removed usage of runBlocking in shared code and replaced it with sensible coroutine-alternatives
  • Renamed all "shared code"-tests to conform JS
    • Replaced space and dash with underscore
  • "shared code"-tests no longer use runBlocking

Breaking changes:

  • SimpleSyntaxExtensions.blockingIntent is now a suspend-function
    • Honestly I would like the other intent-functions to be suspend as well, but this at least is the only one where it's necessary.

Notes:

  • SimpleDslThreadingTest need to be ignored by JS.
    • For some reason calls to withTimeout and awaitCount completely block and never release

@kerkmann
Copy link

Hot! I like! ❤️

@Rosomack
Copy link
Contributor

👀

@maik-mursall
Copy link
Author

Hi @Rosomack :)

Is there a chance for this PR getting reviewed?

@Rosomack
Copy link
Contributor

Hi @maik-mursall , @mattmook and I had a look. Ultimately, we'd love to support JS, but the lack of runBlocking is very limiting. A few comments:

  1. The launch in the intent function is unfortunately not enough to make this work. The function is supposed to return the intent's Job in order to support awaiting and cancelling intents in tests. Here you're returning the Job of the launch coroutine instead. This could result in test flakiness, as we're not referring to the original Job here.
  2. Owing to the above, we don't see a way to support JS without significant internal changes to RealContainer. We'll investigate how to make this possible.
  3. There is a lot of good work here on refactoring tests - this is something we were looking into and will bring these changes across. First, we're going to drop support for the old testing framework to reduce the API surface and the number of changes necessary.

Thanks for taking the time to contribute! We'll keep you posted.

@mattmook
Copy link
Contributor

Closing - we will be adding in JS support shortly... watch this space 😃

@mattmook mattmook closed this May 15, 2025
@Rosomack
Copy link
Contributor

We've just merged #113 adding JS support. Expect a new release soon!

@maik-mursall
Copy link
Author

Hi @Rosomack,
sorry that I didn't react to this for so long. 😅

That's really great to hear. :D
I'm looking forward to it. 🎉

If I have time soon, I'll look at how you guys implemented it and see if I can learn from it. :D

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.

4 participants