(promise)
| 383 | } |
| 384 | |
| 385 | function publish(promise) { |
| 386 | var subscribers = promise._subscribers; |
| 387 | var settled = promise._state; |
| 388 | |
| 389 | if (subscribers.length === 0) { |
| 390 | return; |
| 391 | } |
| 392 | |
| 393 | var child = undefined, |
| 394 | callback = undefined, |
| 395 | detail = promise._result; |
| 396 | |
| 397 | for (var i = 0; i < subscribers.length; i += 3) { |
| 398 | child = subscribers[i]; |
| 399 | callback = subscribers[i + settled]; |
| 400 | |
| 401 | if (child) { |
| 402 | invokeCallback(settled, child, callback, detail); |
| 403 | } else { |
| 404 | callback(detail); |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | promise._subscribers.length = 0; |
| 409 | } |
| 410 | |
| 411 | function ErrorObject() { |
| 412 | this.error = null; |
no test coverage detected