(onFulfillment, onRejection)
| 162 | } |
| 163 | |
| 164 | function then(onFulfillment, onRejection) { |
| 165 | var _arguments = arguments; |
| 166 | |
| 167 | var parent = this; |
| 168 | |
| 169 | var child = new this.constructor(noop); |
| 170 | |
| 171 | if (child[PROMISE_ID] === undefined) { |
| 172 | makePromise(child); |
| 173 | } |
| 174 | |
| 175 | var _state = parent._state; |
| 176 | |
| 177 | if (_state) { |
| 178 | (function () { |
| 179 | var callback = _arguments[_state - 1]; |
| 180 | asap(function () { |
| 181 | return invokeCallback(_state, child, callback, parent._result); |
| 182 | }); |
| 183 | })(); |
| 184 | } else { |
| 185 | subscribe(parent, child, onFulfillment, onRejection); |
| 186 | } |
| 187 | |
| 188 | return child; |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | `Promise.resolve` returns a promise that will become resolved with the |
nothing calls this directly
no test coverage detected