extrinsic-promises
Advanced tools
Comparing version
{ | ||
"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:*", |
@@ -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%