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

Method constructor

extensions/amp-analytics/0.1/requests.js:23–95  ·  view source on GitHub ↗

* @param {!Element} element * @param {!JsonObject} request * @param {!../../../src/preconnect.PreconnectService} preconnect * @param {./transport.Transport} transport * @param {boolean} isSandbox

(element, request, preconnect, transport, isSandbox)

Source from the content-addressed store, hash-verified

21 * @param {boolean} isSandbox
22 */
23 constructor(element, request, preconnect, transport, isSandbox) {
24 /** @const {!Element} */
25 this.element_ = element;
26
27 /** @const {!../../../src/service/ampdoc-impl.AmpDoc} */
28 this.ampdoc_ = element.getAmpDoc();
29
30 /** @const {!Window} */
31 this.win = this.ampdoc_.win;
32
33 /** @const {string} !if specified, all requests are prepended with this */
34 this.requestOrigin_ = request['origin'];
35
36 /** @const {string} */
37 this.baseUrl = devAssert(request['baseUrl']);
38
39 /** @private {Array<number>|number|undefined} */
40 this.batchInterval_ = request['batchInterval']; //unit is sec
41
42 /** @private {?number} */
43 this.reportWindow_ = Number(request['reportWindow']) || null; // unit is sec
44
45 /** @private {?number} */
46 this.batchIntervalPointer_ = null;
47
48 /** @private {!./variables.VariableService} */
49 this.variableService_ = variableServiceForDoc(element);
50
51 /** @private {!../../../src/service/url-replacements-impl.UrlReplacements} */
52 this.urlReplacementService_ = Services.urlReplacementsForDoc(element);
53
54 /** @private {!../../../src/service/url-impl.Url} */
55 this.urlService_ = Services.urlForDoc(element);
56
57 /** @private {?Promise<string>} */
58 this.baseUrlPromise_ = null;
59
60 /** @private {?Promise<string>} */
61 this.requestOriginPromise_ = null;
62
63 /** @private {!Array<!Promise<!BatchSegmentDef>>} */
64 this.batchSegmentPromises_ = [];
65
66 /** @private {!../../../src/preconnect.PreconnectService} */
67 this.preconnect_ = preconnect;
68
69 /** @private {./transport.Transport} */
70 this.transport_ = transport;
71
72 /** @const @private {!Object|undefined} */
73 this.allowlist_ = isSandbox ? SANDBOX_AVAILABLE_VARS : undefined;
74
75 /** @private {?number} */
76 this.batchIntervalTimeoutId_ = null;
77
78 /** @private {?number} */
79 this.reportWindowTimeoutId_ = null;
80

Callers

nothing calls this directly

Calls 6

initReportWindow_Method · 0.95
initBatchInterval_Method · 0.95
devAssertFunction · 0.90
variableServiceForDocFunction · 0.90
nowMethod · 0.80
getAmpDocMethod · 0.45

Tested by

no test coverage detected