You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This adds two additional builds, one for environments where there is an
extremely efficient setImmedaite implementation and asap is just
unnecessary overhead and another for environments where support for
domains is essential.
Copy file name to clipboardExpand all lines: Readme.md
+21-1Lines changed: 21 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ Note that the [es5-shim](https://github.com/es-shims/es5-shim) must be loaded be
43
43
44
44
## Usage
45
45
46
-
The example below shows how you can load the promise library (in a way that works on both client and server). It then demonstrates creating a promise from scratch. You simply call `new Promise(fn)`. There is a complete specification for what is returned by this method in [Promises/A+](http://promises-aplus.github.com/promises-spec/).
46
+
The example below shows how you can load the promise library (in a way that works on both client and server using node or browserify). It then demonstrates creating a promise from scratch. You simply call `new Promise(fn)`. There is a complete specification for what is returned by this method in [Promises/A+](http://promises-aplus.github.com/promises-spec/).
47
47
48
48
```javascript
49
49
varPromise=require('promise');
@@ -56,6 +56,26 @@ var promise = new Promise(function (resolve, reject) {
56
56
});
57
57
```
58
58
59
+
If you need [domains](https://iojs.org/api/domain.html) support, you should instead use:
60
+
61
+
```js
62
+
varPromise=require('promise/domains');
63
+
```
64
+
65
+
If you are in an environment that implements `setImmediate` and don't want the optimisations provided by asap, you can use:
66
+
67
+
```js
68
+
varPromise=require('promise/setimmediate');
69
+
```
70
+
71
+
If you only want part of the features, e.g. just a pure ES6 polyfill:
72
+
73
+
```js
74
+
varPromise=require('promise/lib/es6-extensions');
75
+
// or require('promise/domains/es6-extensions');
76
+
// or require('promise/setimmediate/es6-extensions');
0 commit comments