MCPcopy Create free account
hub / github.com/ampproject/amphtml / createPerformanceObserver_

Method createPerformanceObserver_

src/service/performance-impl.js:521–531  ·  view source on GitHub ↗

* @param {function(!PerformanceEntry)} processEntry * @param {!PerformanceObserverInit} init * @return {!PerformanceObserver} * @private

(processEntry, init)

Source from the content-addressed store, hash-verified

519 * @private
520 */
521 createPerformanceObserver_(processEntry, init) {
522 try {
523 const obs = new this.win.PerformanceObserver((list) => {
524 list.getEntries().forEach(processEntry);
525 this.flush();
526 });
527 obs.observe(init);
528 } catch (err) {
529 dev().warn(TAG, err);
530 }
531 }
532
533 /**
534 * Whether the AMP doc is hidden.

Callers 1

Calls 5

flushMethod · 0.95
devFunction · 0.90
warnMethod · 0.80
forEachMethod · 0.45
observeMethod · 0.45

Tested by

no test coverage detected