These are chat archives for arenanet/api-cdi

4th
Jun 2016
text-decoration: marquee-blink FTFY @Eearslya
smiley
@codemasher
Jun 04 2016 22:21
uhh, can anybody tell me please why does this work? https://github.com/arenanet/api-cdi/blob/master/leaflet-example.html#L91
from what it looks it should behave like
        var data;

        fetch(url)
            .then((res) => res.json())
            .then((res) =>{
                data = res;
                console.log(data); // object
            });

        console.log(data); // undefined, obv.
smiley
@codemasher
Jun 04 2016 22:26
do you only do this because you know the response is in until the object is being used, @lye ?
darthmaim
@darthmaim
Jun 04 2016 22:47

you know

--> you hope

if the fetch(`${apiBase}/wvw/objectives?ids=all`) takes longer than fetch(`${apiBase}/continents?page=0`) that should break
Promise.all around all the fetch and triggering the change event in there should fix this
smiley
@codemasher
Jun 04 2016 22:55
that's about what i thought
might need to wrap my head around promises
any good resources?
darthmaim
@darthmaim
Jun 04 2016 22:57
no idea
smiley
@codemasher
Jun 04 2016 23:25
seriously, all this fetch and promises crap makes me wanna electrocute kittens
ugh, i'm about to go back to prototype Ajax.Request
smiley
@codemasher
Jun 04 2016 23:33
also, with Promise.all i'm basically forcing synchronous loading
ergo: don't bother and wait for http2 everywhere