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

Method init_

src/service/hidden-observer-impl.js:62–75  ·  view source on GitHub ↗

* Initializes the mutation observer and observable.

()

Source from the content-addressed store, hash-verified

60 * Initializes the mutation observer and observable.
61 */
62 init_() {
63 if (this.mutationObserver_) {
64 return;
65 }
66 this.observable_ = new Observable();
67
68 const mo = new this.win_.MutationObserver((mutations) => {
69 if (mutations) {
70 this.observable_.fire(mutations);
71 }
72 });
73 this.mutationObserver_ = mo;
74 mo.observe(this.root_, OBSERVER_OPTIONS);
75 }
76
77 /**
78 * Cleans up the all the mutation observer once the last listener stops

Callers 1

addMethod · 0.95

Calls 2

fireMethod · 0.45
observeMethod · 0.45

Tested by

no test coverage detected