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

Method constructor

src/gesture.js:77–152  ·  view source on GitHub ↗

* @param {!Element} element * @param {boolean} shouldNotPreventDefault * @param {boolean} shouldStopPropagation

(
    element,
    shouldNotPreventDefault = false,
    shouldStopPropagation = false
  )

Source from the content-addressed store, hash-verified

75 * @param {boolean} shouldStopPropagation
76 */
77 constructor(
78 element,
79 shouldNotPreventDefault = false,
80 shouldStopPropagation = false
81 ) {
82 /** @private {!Element} */
83 this.element_ = element;
84
85 /** @private {!Array<!GestureRecognizer>} */
86 this.recognizers_ = [];
87
88 /** @private {!Array<boolean>} */
89 this.tracking_ = [];
90
91 /** @private {!Array<time>} */
92 this.ready_ = [];
93
94 /** @private {!Array<time>} */
95 this.pending_ = [];
96
97 /** @private {?GestureRecognizer} */
98 this.eventing_ = null;
99
100 const win = element.ownerDocument.defaultView;
101 const passiveSupported = supportsPassiveEventListener(toWin(win));
102
103 /** @private {boolean} */
104 this.shouldNotPreventDefault_ = shouldNotPreventDefault || passiveSupported;
105
106 /** @private {boolean} */
107 this.shouldStopPropagation_ = shouldStopPropagation;
108
109 /**
110 * This variable indicates that the eventing has stopped on this
111 * event cycle.
112 * @private {boolean}
113 */
114 this.wasEventing_ = false;
115
116 /** @private {!Pass} */
117 this.pass_ = new Pass(getWin(element), this.doPass_.bind(this));
118
119 /** @private {!Observable} */
120 this.pointerDownObservable_ = new Observable();
121
122 /**
123 * Observers for each type of registered gesture types.
124 * @private {!{[key: string]: !Observable<!Gesture>}}
125 */
126 this.overservers_ = Object.create(null);
127
128 /** @private @const {function(!Event)} */
129 this.boundOnTouchStart_ = this.onTouchStart_.bind(this);
130 /** @private @const {function(!Event)} */
131 this.boundOnTouchEnd_ = this.onTouchEnd_.bind(this);
132 /** @private @const {function(!Event)} */
133 this.boundOnTouchMove_ = this.onTouchMove_.bind(this);
134 /** @private @const {function(!Event)} */

Callers

nothing calls this directly

Calls 5

toWinFunction · 0.90
getWinFunction · 0.90
createMethod · 0.45
addEventListenerMethod · 0.45

Tested by

no test coverage detected