pewpew icon indicating copy to clipboard operation
pewpew copied to clipboard

Looks like the CSV doesn't get loaded in time (sometimes)

Open shantderder opened this issue 5 years ago • 1 comments

Getting a bunch of unreferenced slatlong errors (specifically on chrome), seemingly at random. looks sort of like an async issue?

adding d3-queue.v3.min.js and tossing all the good bits into a deferred queue seems to fix this

      d3.queue()
        .defer(d3.csv, "assets/csv/samplatlong.csv")
        .defer(d3.tsv, "assets/csv/country_centroids_primary.csv")
        .await(analyze);
      function analyze(error, slatlong, centers) {
        if(error) { console.log(error); }

        else {
           console.log("COORDINATES RECEIVED");
          var attacks = {
            interval: getRandomInt(attack_min, attack_max),
            init: function(){
              setTimeout(
                  jQuery.proxy(this.getData, this),
                  this.interval
              );
            },
          getData: function() {
    . . . . etcetc 
     attacks.init();
     } 

shantderder avatar Oct 24 '20 23:10 shantderder

#ty! I'll try to get it into master branch this week. tbh I'm somewhat amazed the code has worked for 6-ish years

hrbrmstr avatar Oct 26 '20 16:10 hrbrmstr