Skip to content

Add a Kotlin/JS target alongside Wasm - #59

Merged
ismai117 merged 1 commit into
mainfrom
feature/js-target
Sep 1, 2026
Merged

ismai117 merged 1 commit into
mainfrom
feature/js-target

Conversation

@ismai117

@ismai117 ismai117 commented Sep 1, 2026

Copy link
Copy Markdown
Owner

The library and the sample built for wasmJs only, so anyone targeting Kotlin/JS could not depend on KScan at all. Both now build from one shared webMain source set

The library and the sample built for wasmJs only, so anyone targeting
Kotlin/JS could not depend on KScan at all. Both now build from one shared
webMain source set, which the default hierarchy template already provides
for the js + wasmJs group.

The JS backend rejects async/await inside js(), so the browser interop is
now written as promise chains: enumerateCameras, detectFromVideoFrame,
imageBitmapFromBase64, startCamera, applyTorch and applyZoom. startCamera's
nested try/catch fallback became .catch() links with a reportFailure helper
that reports how many video inputs the browser can see. Control flow and
error messages are unchanged.

enumerateCameras builds its result with a function expression rather than an
arrow. The js() printer drops the parentheses around an arrow's object
literal body, and collapses an explicit return back into that same body, so
either arrow form emits a block where an expression belongs and webpack
fails to parse it.

CI builds both distributions, and the ABI dump records the web declarations
as js and wasmJs.
@ismai117
ismai117 merged commit a12340d into main Sep 1, 2026
9 checks passed
@ismai117
ismai117 deleted the feature/js-target branch September 1, 2026 15:31
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.

1 participant