Dart lang more than one window .message.add

Good. I am doing a dart program that retrieves the user's location and then changes the geographic location (openmapsapi) and then displays the news with a specific city name (google news api)

I use the following code for openmap api and get the city in local storage. From there I want to use a similar code for google news api, but it throws an error, maybe two lines of window.on.data cannot be added. Part of the code was taken from Seth Ladd’s blog, and I don’t know a bit how everything works.

    window.on.message.add(locReceived);
    Element script = new Element.tag("script");
    var somelat=window.localStorage.$dom_getItem("LAT");
    var somelng=window.localStorage.$dom_getItem("LNG");
    var someurl="http://nominatim.openstreetmap.org/reverse?  format=json&lat="+somelat+"&lon="+somelng+"&addressdetails=1&json_callback=callbackForMapsApi";
    script.src=someurl;
    document.body.elements.add(script);

This is my corresponding html code that I use

      <script type="text/javascript">
function callbackForJsonpApi(s) {
    window.postMessage(JSON.stringify(s), '*');
}

function callbackForMapsApi(s) {
    window.postMessage(JSON.stringify(s), '*');
}
</script>

Not really working on web technologies, any help would be appreciated.

+3
source share
1 answer

window.on.message.add, JavaScript, concurrency. JavaScript :

function callbackForJsonpApi(s) {
    s.target = "dartJsonHandler"
    window.postMessage(JSON.stringify(s), '*');
}

function callbackForMapsApi(s) {
    s.target = "dartMapsHandler";
    window.postMessage(JSON.stringify(s), '*');
}

Dart. DartGap ( DartGap), .

+3

All Articles