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

Function installObserver

3p/environment.js:148–161  ·  view source on GitHub ↗

* Installs a mutation observer in a window to look for iframes. * @param {!Window} win

(win)

Source from the content-addressed store, hash-verified

146 * @param {!Window} win
147 */
148function installObserver(win) {
149 if (!window.MutationObserver) {
150 return;
151 }
152 const observer = new MutationObserver(function (mutations) {
153 for (let i = 0; i < mutations.length; i++) {
154 maybeInstrumentsNodes(win, mutations[i].addedNodes);
155 }
156 });
157 observer.observe(win.document.documentElement, {
158 subtree: true,
159 childList: true,
160 });
161}
162
163/**
164 * Replace timers with variants that can be throttled.

Callers 1

manageWin_Function · 0.85

Calls 2

maybeInstrumentsNodesFunction · 0.85
observeMethod · 0.45

Tested by

no test coverage detected