-
Notifications
You must be signed in to change notification settings - Fork 0
/
es5.js
62 lines (50 loc) · 1.43 KB
/
es5.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
var Esimorp = (function (Object, Promise) {'use strict';
/*! (C) 2017 Andrea Giammarchi @WebReflection (MIT) */
// A reliable ES5 transpiled version of esimorp.js
function Esimorp(fn) {
var _resolve, _reject, self;
self = new Promise(function (resolve, reject) {
_resolve = resolve;
_reject = reject;
if (typeof fn === 'function')
fn(resolve, reject);
});
self._resolve = _resolve;
self._reject = _reject;
self.reject = this.reject;
self.resolve = this.resolve;
return upgrade(self, proto);
}
function setup(where, what, value) {
defineProperty(where, what, {
configurable: true,
writable: true,
value: value
});
}
var
defineProperty = Object.defineProperty,
proto = Esimorp.prototype,
upgrade = Object.setPrototypeOf ||
function (o, p) {
o.__proto__ = p;
return o;
}
;
upgrade(Esimorp, Promise);
upgrade(proto, Promise.prototype);
setup(proto, 'reject', function reject() {
return this._reject.apply(null, arguments), this;
});
setup(proto, 'resolve', function resolve() {
return this._resolve.apply(null, arguments), this;
});
try {
defineProperty(Esimorp, Symbol.species, {
configurable: true,
get: function () { return Promise; }
});
} catch(o_O) {}
return Esimorp;
}(Object, Promise));
try { module.exports = Esimorp; } catch(o_O) {}