Permalink
Browse files

more readme updates

  • Loading branch information...
1 parent 83848ba commit 115169b658c98ff1da3884a5b3784418d92ebb19 @nrstott committed Dec 9, 2011
Showing with 9 additions and 1 deletion.
  1. +9 −1 README.md
View
10 README.md
@@ -305,14 +305,22 @@ they do not take the place of Promises and Promises do not take the place of Eve
### The `then` Method
`promise.then(callback, errback, progress)`
-A promise will have a `then` method which takes up to three parameters.
+A promise will have a `then` method which takes up to three parameters. The three parameters are all optional.
+The first parameter, `callback`, is executed if the Promise is successfully resolved. The second parameter, `errback`, is
+executed if the Promise is rejected. The third parameter, `progress`, is used to provide intermediate feedback on the
+asynchronous operation. This parameter is rarely used. Most promises do not report progress.
### The `when` Function
`bogart.q.when(promiseOrValue, callback, errback, progress)`
The `when` function in the `bogart.q` namespace is helpful when you do not know if what you have is a value or a promise for a
value. The callback will be executed for success for a resoled promise or for the value passed if it is a value and not a promise.
+ // The following two lines are equivalent with the exception that the `when` can
+ // handle values that are not promises.
+ q.when(p, function() { console.log('Success'); });
+ p.then(function() { console.log('Success'); });
+
## JSGI
JSGI stands for JavaScript Gateway Interface. It is an interface between web applications and web servers. It is similar to

0 comments on commit 115169b

Please sign in to comment.