fdaciuk/ajax

Multiple .then calls will only fire the last .then callback

Open

#20 aberto em 4 de abr. de 2016

Ver no GitHub
 (10 comments) (0 reactions) (0 assignees)JavaScript (151 forks)batch import
enhancementhelp wanted

Métricas do repositório

Stars
 (748 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

I have two modules that call .then on the promise returned from an ajax().post call.

// module 1
proto.method = function () {
  return ajax().post(...).then(function (response) {
    // This will not fire if there's a `then` call in module2.method
  });
};

// module 2
proto.method = function () {
  module1.method().then(function (response) {
    // This will fire because it was the last .then to be invoked
  });
};

Only the last callback "registered" with a then call will be invoked. As this is promise-based, I expect to be able to chain then/catch/always calls.

Guia do colaborador