promises-aplus / progress-spec

Discussion and drafts of a possible promise progress signalling spec
5 stars 1 forks source link

Doubling up #4

Open ForbesLindesay opened 11 years ago

ForbesLindesay commented 11 years ago

Do we need to support propagating more progress events than we recieve?


promiseA
  .then(null, null, function (val, prop) { prop(0); prop(1);});
novemberborn commented 11 years ago

That could easily be written as:

var promiseB = promiseA.constructor(function(resolver){
  promiseA.then(resolver.fulfill, resolver.reject, function(val){
    resolver.progress(0);
    resolver.progress(1);
  });
});

And of course libraries could provide a utility methods for that abstraction.

ForbesLindesay commented 11 years ago

True, but that requires breaking your nice clean chain of thens.

domenic commented 11 years ago

The OP idea seems a bit unwise given that you could do setTimeout(prop, 50, 100);