@@ -46,6 +46,9 @@ const PAGE_MODE_MULTIPLIER = 125;
4646 * @param opt_noCaptureIdentifier True if triggering on this event should not
4747 * block execution of other event handlers on this touch or other
4848 * simultaneous touches. False by default.
49+ * @param options An object with options controlling the behavior of the event
50+ * listener. Passed through directly as the third argument to
51+ * `addEventListener`.
4952 * @returns Opaque data that can be passed to unbindEvent_.
5053 */
5154export function conditionalBind (
@@ -54,6 +57,7 @@ export function conditionalBind(
5457 thisObject : object | null ,
5558 func : Function ,
5659 opt_noCaptureIdentifier ?: boolean ,
60+ options ?: AddEventListenerOptions ,
5761) : Data {
5862 /**
5963 *
@@ -75,11 +79,11 @@ export function conditionalBind(
7579 if ( name in Touch . TOUCH_MAP ) {
7680 for ( let i = 0 ; i < Touch . TOUCH_MAP [ name ] . length ; i ++ ) {
7781 const type = Touch . TOUCH_MAP [ name ] [ i ] ;
78- node . addEventListener ( type , wrapFunc , false ) ;
82+ node . addEventListener ( type , wrapFunc , { capture : false , ... options } ) ;
7983 bindData . push ( [ node , type , wrapFunc ] ) ;
8084 }
8185 } else {
82- node . addEventListener ( name , wrapFunc , false ) ;
86+ node . addEventListener ( name , wrapFunc , { capture : false , ... options } ) ;
8387 bindData . push ( [ node , name , wrapFunc ] ) ;
8488 }
8589 return bindData ;
@@ -95,13 +99,17 @@ export function conditionalBind(
9599 * @param name Event name to listen to (e.g. 'mousedown').
96100 * @param thisObject The value of 'this' in the function.
97101 * @param func Function to call when event is triggered.
102+ * @param options An object with options controlling the behavior of the event
103+ * listener. Passed through directly as the third argument to
104+ * `addEventListener`.
98105 * @returns Opaque data that can be passed to unbindEvent_.
99106 */
100107export function bind (
101108 node : EventTarget ,
102109 name : string ,
103110 thisObject : object | null ,
104111 func : Function ,
112+ options ?: AddEventListenerOptions ,
105113) : Data {
106114 /**
107115 *
@@ -119,11 +127,11 @@ export function bind(
119127 if ( name in Touch . TOUCH_MAP ) {
120128 for ( let i = 0 ; i < Touch . TOUCH_MAP [ name ] . length ; i ++ ) {
121129 const type = Touch . TOUCH_MAP [ name ] [ i ] ;
122- node . addEventListener ( type , wrapFunc , false ) ;
130+ node . addEventListener ( type , wrapFunc , { capture : false , ... options } ) ;
123131 bindData . push ( [ node , type , wrapFunc ] ) ;
124132 }
125133 } else {
126- node . addEventListener ( name , wrapFunc , false ) ;
134+ node . addEventListener ( name , wrapFunc , { capture : false , ... options } ) ;
127135 bindData . push ( [ node , name , wrapFunc ] ) ;
128136 }
129137 return bindData ;
0 commit comments