Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shantderder opened this issue Oct 24, 2020 · 1 comment
Open

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

shantderder opened this issue Oct 24, 2020 · 1 comment
Labels

Comments

@shantderder
Copy link

shantderder commented Oct 24, 2020

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();
     } 
@hrbrmstr hrbrmstr added the bug label Oct 26, 2020
@hrbrmstr
Copy link
Owner

#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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants