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

Method onChunk

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

* Callback passed into DetachedDomStream constructor. Receives updated * document everytime a new chunk is written. * Resolves headPromise when body is available, and streams to body iff * bodyTransfer() has been called. * @param {!Document} detachedDoc

(detachedDoc)

Source from the content-addressed store, hash-verified

68 * @param {!Document} detachedDoc
69 */
70 onChunk(detachedDoc) {
71 // <body> is newly formed.
72 if (!this.detachedBody_ && detachedDoc.body) {
73 this.detachedBody_ = detachedDoc.body;
74 this.headResolver_(devAssertElement(detachedDoc.head));
75 }
76
77 // If bodyTransfer has already been called, keep transferring on new chunks.
78 if (this.shouldTransfer_) {
79 this.transferBodyChunk_();
80 }
81 }
82
83 /**
84 * Callback passed into DetachedDomStream constructor. Called with complete

Callers 2

streamResponse_Method · 0.95

Calls 2

transferBodyChunk_Method · 0.95
devAssertElementFunction · 0.90

Tested by

no test coverage detected