Skip to content

Commit 0f49a50

Browse files
committed
Revise docs
Reference the promise's getState() and getResult() methods.
1 parent 9957ebb commit 0f49a50

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Set up
1717
------
1818

1919
Tillthen may be used in the browser through a plain `<script>`-tag, with an AMD module loader,
20-
or as a CommonJS module on Node. It will be automatically exposed in the correct format depending
20+
or as a CommonJS module on Node. It will be automatically exported in the correct format depending
2121
on the detected environment. To get it, `git clone git://github.com/biril/tillthen` or
2222
`npm install tillthen`.
2323

@@ -71,15 +71,17 @@ readFile("foo.txt", "utf-8", function (error, text) {
7171
return deferred.promise;
7272
```
7373

74-
`deferred.promise` exposes the deferred's underlying
75-
[promise](https://github.com/promises-aplus/promises-spec) which features nothing more than a
76-
`then` method.
77-
7874
`defer.resolve(result)` will resolve the promise with given `result`. Thus, it will fulfill the
7975
promise if `result` is a _value_, or cause it to assume `result`'s (future) state if it's a
80-
_promise_ itself. `defer.reject(reason)` will reject the promise with given `reason`.
76+
_promise_ itself. `defer.reject(reason)` will reject the promise with given `reason`.
77+
78+
`deferred.promise` exposes the deferred's underlying
79+
[promise](https://github.com/promises-aplus/promises-spec). Besides the `then` method, this features
80+
a `getState` method (to get the promise's current state) and a `getResult` method (to get the
81+
promise's eventual fulfillment value or rejection reason).
8182

82-
Note that the deffered is itself a promise and as such also features a `then` method.
83+
Note that the deferred object may be used in place of the underlying promise as it also implements
84+
the `then` / `getState` / `getResult` API, merely delegating to the latter.
8385

8486

8587
Testing

0 commit comments

Comments
 (0)