MCPcopy Index your code
hub / github.com/ampproject/amphtml / onInsert

Function onInsert

testing/iframe.js:599–610  ·  view source on GitHub ↗

* Returns a promise for when an element has been added to the given * window. This is for use in tests to wait until after the * attachment of an element to the DOM should have been registered. * @param {!Window} win * @return {!Promise }

(win)

Source from the content-addressed store, hash-verified

597 * @return {!Promise<undefined>}
598 */
599function onInsert(win) {
600 return new Promise((resolve) => {
601 const observer = new win.MutationObserver(() => {
602 observer.disconnect();
603 resolve();
604 });
605 observer.observe(win.document.documentElement, {
606 childList: true,
607 subtree: true,
608 });
609 });
610}
611
612/**
613 * Takes a HTML document that is pointing to unminified JS and HTML binaries and

Callers 1

createIframePromiseFunction · 0.85

Calls 3

resolveFunction · 0.50
disconnectMethod · 0.45
observeMethod · 0.45

Tested by

no test coverage detected