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

fix(KTX2Loader): web worker scope #374

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

roelkok
Copy link
Contributor

@roelkok roelkok commented Jul 3, 2024

Why

The web workers created by KTX2Loader throw the following error: Uncaught ReferenceError: _KTX2Loader is not defined.
This PR fixes that.

What

Updated the BasisWorker function to reference the variables that are prepended to the web worker code instead of referencing these values from the KTX2Loader class.

Although the BasisWorker function is defined within the KTX2Loader class, once it's stringified and used as code for a web worker it doesn't have access anymore to its original upper scope. Therefore it will throw an ReferenceError.

JSDoc type annotations have been added to get the right type hinting in the BasisWorker code.

Checklist

  • Ready to be merged

Fixes:

Copy link

codesandbox-ci bot commented Jul 3, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@CodyJasonBennett CodyJasonBennett merged commit 22fb85e into pmndrs:main Jul 3, 2024
2 checks passed
Copy link

github-actions bot commented Jul 3, 2024

🎉 This PR is included in version 2.30.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants