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

Method constructor

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

* @param {!Window} win

(win)

Source from the content-addressed store, hash-verified

100 * @param {!Window} win
101 */
102 constructor(win) {
103 /** @const {!Window} */
104 this.win = win;
105
106 /** @const {string} */
107 this.eventid_ = base64UrlEncodeFromBytes(
108 getCryptoRandomBytesArray(win, 16)
109 );
110
111 /** @const @private {!Array<TickEventDef>} */
112 this.events_ = [];
113
114 /** @const @private {number} */
115 this.timeOrigin_ =
116 win.performance.timeOrigin || win.performance.timing.navigationStart;
117
118 /** @private {?./ampdoc-impl.AmpDoc} */
119 this.ampdoc_ = null;
120
121 /** @private {?./viewer-interface.ViewerInterface} */
122 this.viewer_ = null;
123
124 /** @private {?./resources-interface.ResourcesInterface} */
125 this.resources_ = null;
126
127 /** @private {?./document-info-impl.DocumentInfoDef} */
128 this.documentInfo_ = null;
129
130 /** @private {boolean} */
131 this.isMessagingReady_ = false;
132
133 /** @private {boolean} */
134 this.isPerformanceTrackingOn_ = false;
135
136 /** @private {!{[key: string]: boolean}} */
137 this.enabledExperiments_ = map();
138
139 /** @private {string|undefined} */
140 this.ampexp_ = undefined;
141
142 /** @private {Signals} */
143 this.metrics_ = new Signals();
144
145 /**
146 * How many times a layout shift metric has been ticked.
147 *
148 * @private {number}
149 */
150 this.shiftScoresTicked_ = 0;
151
152 /**
153 * The collection of layout shift events from the Layout Instability API,
154 * used for normalized windowed sessions according to the latest CWV
155 * implementation. This uses 5s max window with a 1s session gap as the
156 * session size.
157 * See https://github.com/GoogleChrome/web-vitals/blob/main/src/getCLS.ts
158 * @private {Array<LayoutShift>}
159 */

Callers

nothing calls this directly

Calls 15

addEnabledExperimentMethod · 0.95
tickMethod · 0.95
flushMethod · 0.95
onload_Method · 0.95
base64UrlEncodeFromBytesFunction · 0.90
mapFunction · 0.90
devFunction · 0.90
getModeFunction · 0.90

Tested by

no test coverage detected