You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry for jumping out suddenly. I have read a lot about your dicussion and got some thoughts in my head about presenting a reasonalbe value for progress.
My solution is to introduce a concept called fraction. The fraction indicates how complicated do you think the promise is compared to its directly parent promise. By default it's 0.5, which makes the following 2 statements are equal.
Setting fraction to 0.5 may lead to '50%-for-many-50%-for-one' and 'fast-slow' issues (they are same in rough). So if you think the parent promise is much more complicated, 0.1 may be a more proper value for fraction.
If the library itself can handle the calculation for progress, maybe 'value-to-propagate' and 'feedback-for-callbacks-completion' can be saved to leave progress lightwieght. If there are more complicated situations need to be handled, general in-out message mechanism can be called. Things like 'partial' can be handled with something like this:
var prms = new Promise(function(resolver) {
var feedbackPrms = resolver.notify('partial', partialValue);
});
prms.listen('partial', function(value) {
// Do something with the partial result 'value'
return valueToPropagate;
});
What is on the inverse side is out-in message. I have seen other developers implemented cancelpauseresume, and there is no reason people won't ask for more. So may be the general message mechanism is a one-for-all solution. Like this:
var prms = new Promise(function(resolver) {
resolver.register('pause', function(){
// Do pause stuff
});
});
var pausePrms = prms.invoke('pause');
The text was updated successfully, but these errors were encountered:
Sorry for jumping out suddenly. I have read a lot about your dicussion and got some thoughts in my head about presenting a reasonalbe value for progress.
My solution is to introduce a concept called fraction. The fraction indicates how complicated do you think the promise is compared to its directly parent promise. By default it's 0.5, which makes the following 2 statements are equal.
Setting fraction to
0.5
may lead to '50%-for-many-50%-for-one' and 'fast-slow' issues (they are same in rough). So if you think the parent promise is much more complicated,0.1
may be a more proper value for fraction.If the library itself can handle the calculation for progress, maybe 'value-to-propagate' and 'feedback-for-callbacks-completion' can be saved to leave progress lightwieght. If there are more complicated situations need to be handled, general in-out message mechanism can be called. Things like 'partial' can be handled with something like this:
What is on the inverse side is out-in message. I have seen other developers implemented
cancel
pause
resume
, and there is no reason people won't ask for more. So may be the general message mechanism is a one-for-all solution. Like this:The text was updated successfully, but these errors were encountered: