extrinsic-promises
Advanced tools
+21
| Releases: | ||
| - release: 2 | ||
| version: 1.1.0 | ||
| date: 2018-04-12 | ||
| description: Add an `adopt(thennable)` method to settle an `ExtrinsicPromise` based on the settled state of another thennable. | ||
| changes: | ||
| - type: minor | ||
| description: Add `ExtrinsicPromise::adopt()` method | ||
| commits: [749a6ff] | ||
| - type: semantic | ||
| description: Add unit tests to ensure that the `fulfill()` and `reject()` methods are bound | ||
| commits: [ead0460] | ||
| - type: semantic | ||
| description: Document in README that fulfill and reject methods are bound. | ||
| commits: [9fb1eeb] | ||
| - type: semantic | ||
| description: Add CHANGES.yaml | ||
| commits: [005027f] | ||
| - release: 1 | ||
| version: 1.0.0 | ||
| date: 2017-11-20 |
+2
-1
| { | ||
| "name": "extrinsic-promises", | ||
| "version": "1.0.0", | ||
| "version": "1.1.0", | ||
| "description": "A convenient promises anti-pattern: promises you can settle from outside the promise.", | ||
@@ -18,2 +18,3 @@ "keywords": [ | ||
| "check:lint:ci": "npm-run-all --parallel check:lint:ci:*", | ||
| "check:lint:changes": "yamllint CHANGES.yaml", | ||
| "check:lint:readme:markdown": "remark --no-stdout README.md", | ||
@@ -20,0 +21,0 @@ "check:lint:readme": "npm-run-all --parallel check:lint:readme:*", |
+29
-0
@@ -97,2 +97,11 @@ [](https://travis-ci.org/mearns/extrinsic-promises) | ||
| This method is already bound and can be used correctly as a function reference. E.g.,: | ||
| ```javascript | ||
| const exPromise = new ExtrinsicPromise() | ||
| const fulfillLater = exPromise.fulfill | ||
| // ... | ||
| fulfillLater(value) // correctly fulfills exPromise. | ||
| ``` | ||
| ### `ExtrinsicPromise::reject([forReason])` | ||
@@ -103,2 +112,22 @@ | ||
| This method is already bound and can be used correctly as a function reference. E.g.,: | ||
| ```javascript | ||
| const exPromise = new ExtrinsicPromise() | ||
| const rejectLater = exPromise.reject | ||
| // ... | ||
| rejectLater(reason) // correctly rejects exPromise. | ||
| ``` | ||
| ### `ExtrinsicPromise::adopt(thennable)` | ||
| Adopt the state of the given thennable, once the thennable settles, if this extrinsic promise has not _already_ | ||
| settled. This is a convenience for using this extrinsic promise's `fulfill` and `reject` methods as the on-fulfill | ||
| and on-reject handlers, respectively, of the given thennable, as follows: | ||
| ```javascript | ||
| const exPromise = new ExtrinsicPromise() | ||
| thennable.then(exPromise.fulfill, exPromise.reject) | ||
| ``` | ||
| ### `ExtrinsicPromise::work(workfunction)` | ||
@@ -105,0 +134,0 @@ |
68255
2.62%11
10%167
21.01%