spierce7
06/26/2023, 9:27 PMBig Chungus
06/26/2023, 9:44 PMturansky
06/26/2023, 9:46 PMspierce7
06/26/2023, 10:14 PMDylan Sale
06/27/2023, 7:40 AMBig Chungus
06/27/2023, 9:00 AMEdoardo Luppi
06/27/2023, 11:01 AMEdoardo Luppi
06/27/2023, 11:04 AMsuspend fun example(...): Int { ... }
should become:
fun example(...): Promise<Int> =
GlobalScope.promise { ... }
Edoardo Luppi
06/27/2023, 11:06 AMCompletableFuture<T>
Big Chungus
06/27/2023, 11:07 AMEdoardo Luppi
06/27/2023, 11:07 AMBig Chungus
06/27/2023, 11:10 AMEdoardo Luppi
06/27/2023, 11:56 AMBig Chungus
06/27/2023, 11:56 AMBig Chungus
06/27/2023, 11:57 AMBig Chungus
06/27/2023, 11:58 AMEdoardo Luppi
06/27/2023, 11:59 AMEdoardo Luppi
06/27/2023, 12:00 PMEdoardo Luppi
06/27/2023, 12:08 PMwhile exporting suspend functions to JSYou can't really export suspending functions in JS (
[WRONG_EXPORTED_DECLARATION] Declaration of such kind (suspend function) can't be exported to JS
), so you're forced to create a wrapper anywayBig Chungus
06/27/2023, 12:38 PM@JsPromiseExport
suspend fun doShit(diarrhea: Boolean): Int { ... }
KSP would generate
@JsExport
@JsName("doShit")
fun _doShit(diarrhea: Boolean): Promise<Int> = GlobalScope.promise{doShit(diarrhea)}
Then from js you only see the generated version with original name
let shitSize = await doShit(true);
Edoardo Luppi
06/27/2023, 12:47 PMdoShit
is inside a class
?
E.g., to obtain
let shitSize = await myInstance.doShit(true);
Big Chungus
06/27/2023, 12:47 PMEdoardo Luppi
06/27/2023, 12:48 PMBig Chungus
06/27/2023, 12:48 PMawait doShit(instance, true);
Edoardo Luppi
06/27/2023, 12:49 PMBig Chungus
06/27/2023, 12:50 PMEdoardo Luppi
06/27/2023, 12:51 PM@JsPromiseExport
in a class that's not `@JsExport`ed, it's my fault I make something crashBig Chungus
06/27/2023, 12:51 PMEdoardo Luppi
06/27/2023, 12:54 PMDylan Sale
06/28/2023, 12:23 AMEdoardo Luppi
06/28/2023, 7:37 AMEdoardo Luppi
06/28/2023, 7:44 AM