O'Reilly logo

Clojure Reactive Programming by Leonardo Borges

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

core.async

If you've ever done any amount of JavaScript programming, you have probably experienced callback hell. If you haven't, the following code should give you a good idea:

http.get('api/users/find?name=' + name, function(user){
  http.get('api/orders?userId=' + user.id, function(orders){
    orders.forEach(function(order){
      container.append(order);
    });
  });
});

This style of programming can easily get out of hand—instead of writing more natural, sequential steps to achieving a task, that logic is instead scattered across multiple callbacks, increasing the developer's cognitive load.

In response to this issue, the JavaScript community released several promises libraries that are meant to solve the issue. We can think of promises as empty boxes we can ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required