Add support for WasmJs target in addition to exising Js support #68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎯 Goal
Thank you for a great library! I noticed that you have
js
support but notwasmJs
support. For our usage we absolutely needwasmJs
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 awasmJs
section andmain
to be able to launch in the browser, but seeing as one of the dependent librariesio.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 theHsvColorPicker
,AlphaSlider
,BrightnessSlider
and theAlphaTile
.One issue that I did pick up while implementing this is the statement
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
insettings.gradle.kts
. There seems to be a bug here in the KMP plugin when this is enabled along with thewasmJs
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 thesettings.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 runningPreparing a pull request for review
This was done.
Also done.