I have this code here, which I am converting to Dart. The problem is with the callbacks.
function stop(e) {
var node = e.target.getContainer();
node[SMap.LAYER_MARKER].style.cursor = "";
var coords = e.target.getCoords();
alert("Cílová pozice: " + coords.toWGS84(2).reverse().join(" "));
}
var signals = mapa.getSignals();
signals.addListener(window, "marker-drag-stop", stop);
My code in Dart
var signals = mapa.callMethod('getSignals', []);
signals.callMethod('addListener', [context, 'marker-drag-stop', stop]);
}
stop(MouseEvent event) {
var target = event.target.callMethod('getContainer',[]);// problem
context.callMethod('alert', ['texttext']);
}
The stop callback is properly called, but I don't know what to do with var node = e.target.getContainer();
line. The e.target return something, but what next.
Side question: is mapa.callMethod('addLayer', [layer]).callMethod('enable', []);
syntax, only one posible way to call javascript methods. I find it little bit cumbersome:-/
This whole js-interop thingy is kind of messy. I'm unable to resolve it by my own and need to ask again after each step. I hope when I will cover all interop use cases, I will be able, just to use Dart and forget about JS.
I assume this should do the trick: