Thomvis/BrightFutures

adding progress support

mlilback opened this issue · 2 comments

Any thoughts to adding support for progress? I'm thinking something like:

let future = someFunction()
future.onProgress { progress:Progress in 
    //update UI with progress
}.onSuccess { _ in 
}.onFailure ( error in 
}

The progress callback could be rate-limited to delay at least X milliseconds between calls. I'm not sure what to do when chaining futures.

Otherwise, add a (NS)Progress property to Async that can be set in init() and observed via KVO.

Currently my function that returns a future also takes a callback to call periodically on the main queue. It would be great to not have to implement that every time I provide a future.

PR #39 rejected

some use of Progress class could be, waiting for X Futures/Promises, create a new Future/Promise with progress feature ie. be notified for each Futures/Promises completion

Like @phimage said, I don't think progress is part of a Future. For more info, see #39 (comment). Thanks!