snorbi
1
Environment:
- kotlin: 1.3.0-rc-51
- kotlinx-coroutines: 0.26.1-eap13
I have a simple global function:
suspend inline fun function(){
delay(1000)
}
The generated JS code fails at runtime:
Coroutine$function.$metadata$ = {
kind: Kotlin.Kind.CLASS,
simpleName: null,
interfaces: [CoroutineImpl] // "Uncaught ReferenceError: CoroutineImpl is not defined"
};
Other parts of the generated JS code initialize the CoroutineImpl variable correctly like
var CoroutineImpl = Kotlin.kotlin.coroutines.CoroutineImpl;
I think this is a bug and I found no workaround…
What do you think?
snorbi
2
I found a workaround.
I have a multi-platform / multi-module project where there are two kotlin-js modules:
- utility-js: the suspendable
function
is declared here
- app-js (depends on utility-js): the suspendable
function
is called from this module
When I moved function
’s declaration to the app-js module then everything works as expected, the generated JS code now contains
var CoroutineImpl = Kotlin.kotlin.coroutines.CoroutineImpl;
at the beginning of the generated JS code.
snorbi
3
This problem still exists in 1.3.0-rc-146
Can you submit the issue to the tracker? A sample project would be also very helpful.
Thank you!
snorbi
5
Thank you! Will take a look