Skip to content

Commit

Permalink
Added progress sugar documentation in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
iamwilhelm authored and domenic committed Feb 4, 2013
1 parent e6bc235 commit 74e0a21
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,36 @@ foo()
})
```

### Progress Notification

It's possible for some promises to report their progress, especially
if it's a task that takes a long time, or iterates. Not all promises
may implement progress notifications.

```javascript
foo()
.then(function (value) {
// Success processing foo and getting a value
}, function(err) {
// There was an error, and we get the reason for error
}, function(progress) {
// We get notified of foo()'s progress as it's executed
})
```

like `fail`, Q also provides a shorthand for progress callbacks
called `progress`.

```javascript
foo()
.then(function (value) {
// Success processing foo()
}).fail(function(err) {
// There was an error
}).progress(function(prog) {
// We get notified of foo'd progress
})
```

### The End

Expand Down

0 comments on commit 74e0a21

Please sign in to comment.