* @param {!Window} win * @param {(function(!Function):!Promise)=} opt_transferThrottleFunc
(win, opt_transferThrottleFunc)
| 15 | * @param {(function(!Function):!Promise)=} opt_transferThrottleFunc |
| 16 | */ |
| 17 | constructor(win, opt_transferThrottleFunc) { |
| 18 | const headDefer = new Deferred(); |
| 19 | /** |
| 20 | * Resolves when head has been written to in memory document. |
| 21 | * @const @private {!Promise<!Element>} |
| 22 | */ |
| 23 | this.headPromise_ = headDefer.promise; |
| 24 | |
| 25 | /** @const @private {!function(!Element)} */ |
| 26 | this.headResolver_ = headDefer.resolve; |
| 27 | |
| 28 | const transferDefer = new Deferred(); |
| 29 | /** |
| 30 | * Resolves when complete doc has been transferred to the target |
| 31 | * body. |
| 32 | * @const @private {!Promise} |
| 33 | */ |
| 34 | this.bodyTransferPromise_ = transferDefer.promise; |
| 35 | |
| 36 | /** @const @private {!function(!Promise)} */ |
| 37 | this.bodyTransferResolver_ = transferDefer.resolve; |
| 38 | |
| 39 | /** @private {?Element} */ |
| 40 | this.detachedBody_ = null; |
| 41 | |
| 42 | const targetBodyDefer = new Deferred(); |
| 43 | /** |
| 44 | * Resolves when target body is ready to receive elements. |
| 45 | * @private {!Promise<!Element>} |
| 46 | */ |
| 47 | this.targetBodyPromise_ = targetBodyDefer.promise; |
| 48 | |
| 49 | /** @const @private {!function(!Element)} */ |
| 50 | this.targetBodyResolver_ = targetBodyDefer.resolve; |
| 51 | |
| 52 | /** @private {?Promise} */ |
| 53 | this.currentChunkTransferPromise_ = null; |
| 54 | |
| 55 | /** @private {boolean} */ |
| 56 | this.shouldTransfer_ = false; |
| 57 | |
| 58 | /** @private @const */ |
| 59 | this.transferThrottle_ = |
| 60 | opt_transferThrottleFunc || DEFAULT_TRANSFER_THROTTLE_FUNC; |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Callback passed into DetachedDomStream constructor. Receives updated |
nothing calls this directly
no outgoing calls
no test coverage detected