Phil Burk
06/28/2025, 1:09 AM//import exports from "./module.mjs"
import exports from "./composeApp.js"
console.log("Kotlin random code is " + exports.renderKotlinAudio());
But I always get:
SyntaxError: Unexpected identifier 'exports'
I am using Kotlin/Compose multi-platform code. My Kotlin WASM code has:
@OptIn(ExperimentalJsExport::class)
@JsExport
fun renderKotlinAudio(): Float {
return Random.nextFloat()
}
I spent a lot of time with Gemini giving me increasingly complex solutions that did not work.
Has anyone actually done this successfully?turansky
07/02/2025, 7:12 PMAudioWorkletProcessor you should have separate JS filePhil Burk
09/23/2025, 11:47 PMPhil Burk
09/24/2025, 12:57 AMconst kotlinModulePromise = window.composeApp;
kotlinModulePromise.then(kotlinModule => {
console.log("renderKotlinAudio returns " + kotlinModule.renderKotlinAudio);
console.log("renderKotlinAudio returns " + kotlinModule.renderKotlinAudio);
}).catch(e => {
// It's good practice to catch potential loading errors
console.error("Error loading Kotlin module:", e);
document.getElementById('output').textContent = "Error loading the application module.";
});turansky
09/24/2025, 1:50 AMAudioWorkletProcessor on Kotlin/JS example you can find here.turansky
09/24/2025, 1:52 AMPhil Burk
09/24/2025, 2:00 AMPhil Burk
09/24/2025, 5:05 PMturansky
09/24/2025, 8:04 PMIs Seskar needed to use the Kotlin wrappers for audio?Yes, Seskar supports Kotlin Wrappers declarations only
turansky
09/24/2025, 8:06 PMAudioWorkletProcessor in other declarations?Phil Burk
09/24/2025, 10:21 PMturansky
09/24/2025, 10:40 PMsuspend calls?Phil Burk
09/25/2025, 9:25 PMCan it beThe blocking write() does not use the suspend keyword. https://github.com/philburk/kc-audio-bridge/blob/main/composeApp/src/commonMain/kotlin/com/mobileer/audiobridge/AudioBridge.ktcalls?suspend
turansky
09/25/2025, 11:47 PM