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

Method constructor

extensions/amp-bind/0.1/bind-impl.js:113–219  ·  view source on GitHub ↗

* @param {!../../../src/service/ampdoc-impl.AmpDoc} ampdoc

(ampdoc)

Source from the content-addressed store, hash-verified

111 * @param {!../../../src/service/ampdoc-impl.AmpDoc} ampdoc
112 */
113 constructor(ampdoc) {
114 /** @const {!../../../src/service/ampdoc-impl.AmpDoc} */
115 this.ampdoc = ampdoc;
116
117 /** @const @private {!Window} */
118 this.win_ = ampdoc.win;
119
120 /**
121 * The window containing the document to scan.
122 * May differ from the `ampdoc`'s window e.g. in FIE.
123 * @const @private {!Window}
124 */
125 this.localWin_ = ampdoc.win;
126
127 /**
128 * Array of ActionInvocation.sequenceId values that have been invoked.
129 * Used to ensure that only one "AMP.setState" or "AMP.pushState" action
130 * may be triggered per event. Periodically cleared.
131 * @const @private {!Array<number>}
132 */
133 this.actionSequenceIds_ = [];
134
135 /** @const @private {!Function} */
136 this.eventuallyClearActionSequenceIds_ = debounce(
137 this.win_,
138 () => {
139 this.actionSequenceIds_.length = 0;
140 },
141 5000
142 );
143
144 /** @private {!Array<BoundElementDef>} */
145 this.boundElements_ = [];
146
147 /**
148 * Maps expression string to the element(s) that contain it.
149 * @private @const {!{[key: string]: !Array<!Element>}}
150 */
151 this.expressionToElements_ = map();
152
153 /** @private {!../../../src/service/history-impl.History} */
154 this.history_ = Services.historyForDoc(ampdoc);
155
156 /** @private {!Array<string>} */
157 this.overridableKeys_ = [];
158
159 /**
160 * Upper limit on total number of bindings.
161 *
162 * The initial value is set to 1000 which, based on ~2ms expression parse
163 * time, caps "time to interactive" at ~2s after page load.
164 *
165 * User interactions can add new bindings (e.g. infinite scroll), so this
166 * can increase over time to a final limit of 2000 bindings.
167 *
168 * @private {number}
169 */
170 this.maxNumberOfBindings_ = 1000;

Callers

nothing calls this directly

Calls 9

initialize_Method · 0.95
setStateMethod · 0.95
debounceFunction · 0.90
mapFunction · 0.90
onMessageRespondMethod · 0.45
thenMethod · 0.45
whenFirstVisibleMethod · 0.45
whenReadyMethod · 0.45
getRootNodeMethod · 0.45

Tested by

no test coverage detected