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

Method constructor

extensions/amp-analytics/0.1/activity-impl.js:150–192  ·  view source on GitHub ↗

* Activity tracks basic user activity on the page. * - Listeners are not registered on the activity event types until the * AmpDoc's `whenFirstVisible` is resolved. * - When the `whenFirstVisible` of AmpDoc is resolved, a first activity * is recorded. * - The first activity i

(ampdoc)

Source from the content-addressed store, hash-verified

148 * @param {!../../../src/service/ampdoc-impl.AmpDoc} ampdoc
149 */
150 constructor(ampdoc) {
151 /** @const {!../../../src/service/ampdoc-impl.AmpDoc} ampdoc */
152 this.ampdoc = ampdoc;
153
154 /** @private @const {function()} */
155 this.boundStopIgnore_ = this.stopIgnore_.bind(this);
156
157 /** @private @const {function()} */
158 this.boundHandleActivity_ = this.handleActivity_.bind(this);
159
160 /** @private @const {function()} */
161 this.boundHandleInactive_ = this.handleInactive_.bind(this);
162
163 /** @private @const {function()} */
164 this.boundHandleVisibilityChange_ = this.handleVisibilityChange_.bind(this);
165
166 /**
167 * Contains the incrementalEngagedTime timestamps for named triggers.
168 * @private {{[key: string]: number}}
169 */
170 this.totalEngagedTimeByTrigger_ = {
171 /*
172 * "$triggerName" : ${lastRequestTimestamp}
173 */
174 };
175
176 /** @private {Array<!UnlistenDef>} */
177 this.unlistenFuncs_ = [];
178
179 /** @private {boolean} */
180 this.ignoreActivity_ = false;
181
182 /** @private {boolean} */
183 this.ignoreInactive_ = false;
184
185 /** @private @const {!ActivityHistory} */
186 this.activityHistory_ = new ActivityHistory();
187
188 /** @private @const {!../../../src/service/viewport/viewport-interface.ViewportInterface} */
189 this.viewport_ = Services.viewportForDoc(this.ampdoc);
190
191 this.ampdoc.whenFirstVisible().then(this.start_.bind(this));
192 }
193
194 /** @private */
195 start_() {

Callers

nothing calls this directly

Calls 2

thenMethod · 0.45
whenFirstVisibleMethod · 0.45

Tested by

no test coverage detected