1 | import Promise from './index';
|
2 | import promiseFinally from './finally';
|
3 | import allSettled from './allSettled';
|
4 |
|
5 |
|
6 | var globalNS = (function() {
|
7 |
|
8 |
|
9 |
|
10 | if (typeof self !== 'undefined') {
|
11 | return self;
|
12 | }
|
13 | if (typeof window !== 'undefined') {
|
14 | return window;
|
15 | }
|
16 | if (typeof global !== 'undefined') {
|
17 | return global;
|
18 | }
|
19 | throw new Error('unable to locate global object');
|
20 | })();
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | if (typeof globalNS['Promise'] !== 'function') {
|
27 | globalNS['Promise'] = Promise;
|
28 | } else if (!globalNS.Promise.prototype['finally']) {
|
29 | globalNS.Promise.prototype['finally'] = promiseFinally;
|
30 | } else if (!globalNS.Promise.allSettled) {
|
31 | globalNS.Promise.allSettled = allSettled;
|
32 | }
|