Git Product home page Git Product logo

Comments (2)

mbostock avatar mbostock commented on May 18, 2024

If only the first task is being executed, it’s probably because you are forgetting to invoke the callback when your task completes. A functional example:

var q = queue(1);

for (var i = 0; i < 10; ++i) {
  q.defer(function(callback) {
    setTimeout(function() {
      console.log("task running…");
      callback(null, Math.random());
    }, 50);
  });
}

q.awaitAll(function(error, results) {
  if (error) throw error;
  console.log(results);
});

from d3-queue.

mchinosi avatar mchinosi commented on May 18, 2024

Thanks a lot. I already solved the problem the same way when I closed the issue. The problem in my case was related to the nature of the task. In fact each task in my case was calling a function passing an object as argument holding another function to be executed with its parameters as a callback of a successful async ajax request. So having this chain of calls I didn't understand why I had to put explicitely a callback for the task, since I had no other need to return the result (uhm... actually now I'm returning a 'fake' result) of the last function of the chain back to the calling task. Anyway, thanks again for your help. Now it is working.

from d3-queue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.