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

Add support for WasmJs target in addition to exising Js support #68

Merged
merged 4 commits into from
Jul 19, 2024

Conversation

Phaestion
Copy link
Contributor

🎯 Goal

Thank you for a great library! I noticed that you have js support but not wasmJs support. For our usage we absolutely need wasmJs support for all libraries that we use. Adding it is not a big task and since the library is already in a KMP structure it's just some configuration and adding of an example.

🛠 Implementation details

Initially I wanted to extend the app example by adding a wasmJs section and main to be able to launch in the browser, but seeing as one of the dependent libraries io.github.onseok:peekaboo-image-picker only targets iOS and Android this was not possible.
Instead I opted for adding a new module called wasmApp and did a basic implementation for showing the HsvColorPicker, AlphaSlider, BrightnessSlider and the AlphaTile.

One issue that I did pick up while implementing this is the statementrepositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) in settings.gradle.kts. There seems to be a bug here in the KMP plugin when this is enabled along with the wasmJs target. I'm unsure why this is needed in the settings, perhaps you can shed some light on the usage of this statement seeing as everything seems to work fine without it. I added a comment to the settings.gradle.kts file to make the change apparent.

✍️ Explain examples

I added a new gradle module with a wasmJs configuration and setup to test this out. You can test this out by running

$ ./gradlew wasmApp:wasmJsBrowserDevelopmentRun

Preparing a pull request for review

This was done.

Ensure your change is properly formatted by running:

$ ./gradlew spotlessApply

Also done.

Please correct any failures before requesting a review.

@Phaestion Phaestion requested a review from skydoves as a code owner July 19, 2024 06:00
Copy link
Owner

@skydoves skydoves left a comment

Choose a reason for hiding this comment

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

Hey @Phaestion, this looks very good to me! Thank you for your contribution. ❤️ I will release the next version as soon as possible.

@skydoves skydoves merged commit 91c88ec into skydoves:main Jul 19, 2024
3 checks passed
@Phaestion
Copy link
Contributor Author

Thanks @skydoves! A new release would be greatly appreciated, we'd like to use this feature in one of our wasm apps. 😄

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