This has lots of holes in it, I'm putting it here though, because I'm hoping that we'll start to see where the holes are and fill some of them in a little.
Progress/A+
This proposal specifies how progress is triggered and propagated in a PromisesA+ promise library.
Requirements
The then method
The then method is the same as that specified in the promises-spec except that it also takes a third argument. We'll call that third argument the onProgress.
The onProgress
- If the
onProgress is not a function
- It is ignored
- If the
onProgress is a function
- When progress is emitted, the
onProgress is called with the ProgressValue as the first argument.
- If the
onProgress throws an exception with a .name property equal to 'StopProgressPropagation' then the error is silenced and progress is not propagated. In all other cases, the result of the function is used as the progress value to propagate.
onProgress is never called once a promise has already been fulfilled or rejected.
The progress method
The resolver has a .progress(value) method. This triggers all the onProgress methods. It returns a promise which is fulfilled with undefined once all progress methods are complete or is rejected with the first (non-StopProgressPropagation) exception thrown by the handlers, if any.
This has lots of holes in it, I'm putting it here though, because I'm hoping that we'll start to see where the holes are and fill some of them in a little.
Progress/A+
This proposal specifies how progress is triggered and propagated in a PromisesA+ promise library.
Requirements
The
thenmethodThe then method is the same as that specified in the promises-spec except that it also takes a third argument. We'll call that third argument the
onProgress.The
onProgressonProgressis not a functiononProgressis a functiononProgressis called with theProgressValueas the first argument.onProgressthrows an exception with a.nameproperty equal to'StopProgressPropagation'then the error is silenced and progress is not propagated. In all other cases, the result of the function is used as the progress value to propagate.onProgressis never called once a promise has already been fulfilled or rejected.The
progressmethodThe resolver has a
.progress(value)method. This triggers all theonProgressmethods. It returns a promise which is fulfilled withundefinedonce all progress methods are complete or is rejected with the first (non-StopProgressPropagation) exception thrown by the handlers, if any.