Marius Ailinca
08/19/2021, 8:29 AMvar map = new H.Map(
{
center: {lat: 40.745390, lng: -74.022917},
zoom: 13.2
});
center is not properly initialized. I tried defining an interface for center (IPoint) and pass an object:IPoint to the constructor but it doesn't work. Tried to implement the interface in a class and still doesn't work. How to I pass a json anonymous object from kotlin to js? Thank you!Hywel Bennett
08/19/2021, 1:32 PMdynamic
and use the js()
function, e.g. js("{}")
to generate the object?turansky
08/19/2021, 2:45 PMdynamic
please 🙂turansky
08/19/2021, 2:50 PMexternal interface Location {
var lat: Double
var lng: Double
}
external interface MapOptions {
var center: Location
var zoom: Double
}
// your module config
external class Map(options: MapOptions)
fun main() {
val map = Map(
options = jsObject {
center = jsObject { lat = 40.2, lng = -74.1 },
zoom = 13.2,
}
)
}
Marius Ailinca
08/19/2021, 3:59 PMturansky
08/19/2021, 4:02 PMjs {}
if you want dynamic
as result