quiro
05/15/2024, 9:43 PM@JsExport data class Response(val b: Map<String, Int>)
@JsExport fun response() = Response(mutableMapOf("c", 1))
On the javascript side, I expect something similar to be returned, but instead what I see
{ "b": { "c": 1 } }
When I debug this on the javascript side, I see a lot of properties are
{
"b": {
"_keys_1": null,
"_values_1": null,
"keysView_1": null,
"valuesView_1": null,
"entriesView_1": null,
... // a lot more properties
}
}
jw
05/15/2024, 10:30 PMjw
05/15/2024, 10:32 PMjw
05/15/2024, 10:32 PMjw
05/15/2024, 10:36 PMquiro
05/16/2024, 7:28 AMMap<String, V>
, where the keys are not defined at compile time 🤔turansky
05/16/2024, 7:44 AM@JsPlainObject
- annotation for external interfaces.
You can use it right now in Kotlin 1.9 with jso
factory method, which will create required JSO.turansky
05/16/2024, 7:46 AMrecordOf
function.turansky
05/16/2024, 7:49 AMjso
or factory created by @JsPlainObject
= JSO with strict fields
Record
interface + recordOf
factory = JSO with dynamic fieldsEdoardo Luppi
05/16/2024, 2:35 PMEdoardo Luppi
05/16/2024, 2:40 PMconst mutableMap = provideMutableMap() // Kotlin fun
const mutableMapView = mutableMap.asJsMapView() // Allow JS consumer to modify the Kotlin map