https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
m

marcinmoskala

01/23/2018, 12:28 PM
I see that
@JvmName
can be used on common modules, but
@JsName
not. Any way to set name for JS in multiplatform projects? (Problem is that JS doesn't accept names like
Copy code
fun `this is name`(){}
)
a

anton.bannykh

01/23/2018, 12:38 PM
You could
expect
a custom annotation in your common module and
typealias
it to
@JsName
in JS module. When compiling to JavaScript that would work as if you've used
@JsName
in the common code.
m

marcinmoskala

01/23/2018, 4:20 PM
Thanks, simple idea but it works perfectly 🙂
a

anton.bannykh

01/23/2018, 4:22 PM
You are welcome. We are aware that using platfrom annotations in common code is not convenient at the moment. Hopefully there will be an easier solution before MPP is officially released (it is experimental for now).
m

marcinmoskala

01/24/2018, 4:40 AM
Yeah. Kotlin was in experimental stage for like 6 years xP But I've been using it on the production eather way 😉
a

anton.bannykh

01/24/2018, 11:35 AM
😀
2 Views