For those interested in the progress of Compose We...
# compose-web
o
For those interested in the progress of Compose Web in full WebAssembly applications, here is an updated version of compose-counting-grid, based on the Kotlin 1.9.0 release. The README describes how to run Jvm, Web/Js and Web/Wasm targets. Notably, Wasm is now consistently faster than Js in all scenarios (a previous version exhibited low Wasm frame rates with animations). Enjoy!
🙌🏻 1
p
So with 1.9.0 BrowserViewportWindow doesn't work anymore 😢 Any alternative?
o
I haven't really looked at it yet, as it just doesn't resize for now (initial sizing still works).
d
New
androidx.compose.ui.window.CanvasBasedWindow
appears to offer the same full-browser resizing, and is working with Web/WASM
1.9.0
.
p
CanvasBasedWindow
sounds great
d
@Oliver.O I found that when building for distribution, Joda had to be additionally copied to the distribution output path at:
/dist/wasm/productionExecutable
. So I made some functions:
WASM Module Copying Hack
Note addition of
mustRunAfter("kotlinNpmInstall")
as I was seeing the copy fail due to running before Joda had been downloaded, from clean.
image.png
o
Good catch! Maybe
mustRunAfter("kotlinNpmInstall")
alone would be sufficient for proper sequencing. Regarding the copying of multiple Node modules, wouldn't it be easier to supply a list of module names and copy everything in one task? (Ideally, the list would be automatically generated, but since the current approach also requires modules to be listed in an HTML
importmap
script, I'd rather wait for the Wasm support in the Kotlin Gradle plugin to improve.)
d
ℹ️ In case anyone grabbed that workaround code above; I've just slightly improved it (updated the snippet) with comments + making the Dev task depend on Webpack, not just Run. I'm going to be using Webpack as my psuedo-Distribution task, until the 'true' distribution story matures.