Skip to content

CheerpJ loader now is called directly from path stored in .env #3

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Orpheus-3145
Copy link
Contributor

@Orpheus-3145 Orpheus-3145 commented Apr 25, 2025

Changed made:

  • .env file now has the path of the CheerpJ loader itself
  • removed async call for reading the old path to fetch CheerpJ loader, using now dynamic JS to add the <script> (that contains the loader source) tag to

Copy link
Member

@saarikoski-jules saarikoski-jules left a comment

Choose a reason for hiding this comment

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

Looks mostly good to me. @alexp-sssup which version of cj should we use here? The latest nightly or did we want to use some major version?

@alexp-sssup
Copy link
Member

We should stick to 4.0 @Orpheus-3145 please use the public 4.0/loader.js path, not the internal 4.0_NNN one.

JavaFiddle is based on Java 8, which is now very stable.

Copy link

cloudflare-workers-and-pages bot commented Apr 25, 2025

Deploying javafiddle with  Cloudflare Pages  Cloudflare Pages

Latest commit: c74ec89
Status: ✅  Deploy successful!
Preview URL: https://bad9fcac.javafiddle.pages.dev
Branch Preview URL: https://killlatest.javafiddle.pages.dev

View logs

@Orpheus-3145
Copy link
Contributor Author

I updated the path with the 4.0 version

<!-- CheerpJ is loading -->
{:then src}
{#if src}
<script {src} on:load={onLoad}></script>
Copy link
Member

Choose a reason for hiding this comment

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

Build the script using the svelte syntax, we can hardcode the known URL and remove the onMount handler

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you are suggesting to do something like this:

<svelte:head>
    <script {src} on:load={onLoad}></script>
</svelte:head>

It will not work, that is way I used raw js instead.
I also saw some posts on github addressing the same problem; if we do not want to stick with ugly js, a possible solution would be to upgrade svelteKit to a newer version, but I'm not sure about that.

Copy link
Member

Choose a reason for hiding this comment

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

You don't need onLoad at all. If the script is directly added to the page then you are guaranteed that by the time later scripts are executed the loader is ready to be used.

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.

3 participants