Császár Ákos
08/25/2023, 11:41 AM@OptIn(DelicateCoroutinesApi::class)
fun testFunctionInline(): Promise<String> =
GlobalScope.promise(Dispatchers.Default) {
return@promise "hello with inline"
}
I get the this error
Uncaught (in promise) TypeError: parentContext.q3 is not a function
at DeferredCoroutine.AbstractCoroutine (as constructor (index-1da9d773.s:124914133)
at new DeferredCoroutine (<http://index-1da9d773.is|index-1da9d773.is>: 125056:27)
at async index-1da9d773 15 124993 86)
at promise (index-1da9d773.5:128534:26)
at protoot2. testFunctionIn line (index-1da9d773.15:135390:14)
at Object. testKmpLib (index-1da9d773.1s:136760:29)
_ConfigService index-1da9d773.15:136742:15
at index-1da9d773.js:136860:23
If I use with a ReactJs project, its working. Any idea what is the problem?Artem Kobzar
08/25/2023, 12:34 PMCsászár Ákos
08/25/2023, 1:44 PMArtem Kobzar
08/25/2023, 2:25 PMCsászár Ákos
08/28/2023, 6:10 AMArtem Kobzar
08/28/2023, 7:44 AMCsászár Ákos
08/28/2023, 8:37 AMnpm publish
) and I add the library to the JsProject with npm install
.
I also observed that this issue happens only when there are 2 KMP projects imported to the same JS project. Both using GlobalScope.promise(). I am not completely sure how it works, but maybe here is the problem. The stack trace also points to CoroutineScope.async() function which is called when using GlobalScope.promise.Császár Ákos
08/28/2023, 12:30 PMArtem Kobzar
08/28/2023, 12:30 PMJan Starczewski
04/24/2024, 7:57 AMCsászár Ákos
04/24/2024, 7:59 AMGlobalScope.promise(Dispathers.Default)
I am using CoroutineScope(Dispatchers.Unconfined).promise
Jan Starczewski
04/24/2024, 8:05 AM