OLD | NEW |
1 function MakePromise (asap) { | 1 function MakePromise (asap) { |
2 function Promise(fn) { | 2 function Promise(fn) { |
3 if (typeof this !== 'object' || typeof fn !== 'function') throw
new TypeError(); | 3 if (typeof this !== 'object' || typeof fn !== 'function') throw
new TypeError(); |
4 this._state = null; | 4 this._state = null; |
5 this._value = null; | 5 this._value = null; |
6 this._deferreds = [] | 6 this._deferreds = [] |
7 | 7 |
8 doResolve(fn, resolve.bind(this), reject.bind(this)); | 8 doResolve(fn, resolve.bind(this), reject.bind(this)); |
9 } | 9 } |
10 | 10 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 }; | 119 }; |
120 | 120 |
121 | 121 |
122 return Promise; | 122 return Promise; |
123 } | 123 } |
124 | 124 |
125 if (typeof module !== 'undefined') { | 125 if (typeof module !== 'undefined') { |
126 module.exports = MakePromise; | 126 module.exports = MakePromise; |
127 } | 127 } |
128 | 128 |
OLD | NEW |