MCPcopy
hub / github.com/ampproject/amphtml / transferBodyChunk_

Method transferBodyChunk_

src/utils/dom-transform-stream.js:137–158  ·  view source on GitHub ↗

* Transfers available body elements in vsync cycle. * @return {!Promise}

()

Source from the content-addressed store, hash-verified

135 * @return {!Promise}
136 */
137 transferBodyChunk_() {
138 if (this.currentChunkTransferPromise_) {
139 return this.currentChunkTransferPromise_;
140 }
141
142 this.currentChunkTransferPromise_ = Promise.all([
143 this.targetBodyPromise_,
144 this.headPromise_,
145 ]).then((resolvedElements) => {
146 const transferThrottle = this.transferThrottle_;
147 return transferThrottle(() => {
148 this.currentChunkTransferPromise_ = null;
149 const targetBody = resolvedElements[0];
150 removeNoScriptElements(devAssertElement(this.detachedBody_));
151 while (this.detachedBody_.firstChild) {
152 targetBody.appendChild(this.detachedBody_.firstChild);
153 }
154 });
155 });
156
157 return this.currentChunkTransferPromise_;
158 }
159}

Callers 3

onChunkMethod · 0.95
onEndMethod · 0.95
transferBodyMethod · 0.95

Calls 3

removeNoScriptElementsFunction · 0.90
devAssertElementFunction · 0.90
thenMethod · 0.45

Tested by

no test coverage detected