mirror of
https://github.com/Polymer/polymer.git
synced 2026-08-17 16:34:49 -05:00
Update TemplateStamp event listen param types from Node to EventTarget. (#5320)
Update TemplateStamp event listen param types from Node to EventTarget. Allows passing e.g. window.
This commit is contained in:
@@ -45,7 +45,7 @@ export const GestureEventListeners = dedupingMixin(
|
||||
/**
|
||||
* Add the event listener to the node if it is a gestures event.
|
||||
*
|
||||
* @param {!Node} node Node to add event listener to
|
||||
* @param {!EventTarget} node Node to add event listener to
|
||||
* @param {string} eventName Name of event
|
||||
* @param {function(!Event):void} handler Listener function to add
|
||||
* @return {void}
|
||||
@@ -60,7 +60,7 @@ export const GestureEventListeners = dedupingMixin(
|
||||
/**
|
||||
* Remove the event listener to the node if it is a gestures event.
|
||||
*
|
||||
* @param {!Node} node Node to remove event listener from
|
||||
* @param {!EventTarget} node Node to remove event listener from
|
||||
* @param {string} eventName Name of event
|
||||
* @param {function(!Event):void} handler Listener function to remove
|
||||
* @return {void}
|
||||
|
||||
@@ -444,7 +444,7 @@ export const TemplateStamp = dedupingMixin(
|
||||
* This method generates a handler function that looks up the method
|
||||
* name at handling time.
|
||||
*
|
||||
* @param {!Node} node Node to add listener on
|
||||
* @param {!EventTarget} node Node to add listener on
|
||||
* @param {string} eventName Name of event
|
||||
* @param {string} methodName Name of method
|
||||
* @param {*=} context Context the method will be called on (defaults
|
||||
@@ -462,7 +462,7 @@ export const TemplateStamp = dedupingMixin(
|
||||
/**
|
||||
* Override point for adding custom or simulated event handling.
|
||||
*
|
||||
* @param {!Node} node Node to add event listener to
|
||||
* @param {!EventTarget} node Node to add event listener to
|
||||
* @param {string} eventName Name of event
|
||||
* @param {function(!Event):void} handler Listener function to add
|
||||
* @return {void}
|
||||
@@ -475,7 +475,7 @@ export const TemplateStamp = dedupingMixin(
|
||||
/**
|
||||
* Override point for adding custom or simulated event handling.
|
||||
*
|
||||
* @param {!Node} node Node to remove event listener from
|
||||
* @param {!EventTarget} node Node to remove event listener from
|
||||
* @param {string} eventName Name of event
|
||||
* @param {function(!Event):void} handler Listener function to remove
|
||||
* @return {void}
|
||||
|
||||
@@ -493,7 +493,7 @@ function _handleTouchAction(ev) {
|
||||
/**
|
||||
* Adds an event listener to a node for the given gesture type.
|
||||
*
|
||||
* @param {!Node} node Node to add listener on
|
||||
* @param {!EventTarget} node Node to add listener on
|
||||
* @param {string} evType Gesture type: `down`, `up`, `track`, or `tap`
|
||||
* @param {!function(!Event):void} handler Event listener function to call
|
||||
* @return {boolean} Returns true if a gesture event listener was added.
|
||||
@@ -509,7 +509,7 @@ export function addListener(node, evType, handler) {
|
||||
/**
|
||||
* Removes an event listener from a node for the given gesture type.
|
||||
*
|
||||
* @param {!Node} node Node to remove listener from
|
||||
* @param {!EventTarget} node Node to remove listener from
|
||||
* @param {string} evType Gesture type: `down`, `up`, `track`, or `tap`
|
||||
* @param {!function(!Event):void} handler Event listener function previously passed to
|
||||
* `addListener`.
|
||||
@@ -527,7 +527,7 @@ export function removeListener(node, evType, handler) {
|
||||
* automate the event listeners for the native events
|
||||
*
|
||||
* @private
|
||||
* @param {!Node} node Node on which to add the event.
|
||||
* @param {!EventTarget} node Node on which to add the event.
|
||||
* @param {string} evType Event type to add.
|
||||
* @param {function(!Event)} handler Event handler function.
|
||||
* @return {void}
|
||||
@@ -566,7 +566,7 @@ function _add(node, evType, handler) {
|
||||
* automate event listener removal for native events
|
||||
*
|
||||
* @private
|
||||
* @param {!Node} node Node on which to remove the event.
|
||||
* @param {!EventTarget} node Node on which to remove the event.
|
||||
* @param {string} evType Event type to remove.
|
||||
* @param {function(!Event): void} handler Event handler function.
|
||||
* @return {void}
|
||||
@@ -630,12 +630,12 @@ function _findRecognizerByEvent(evName) {
|
||||
* This value is checked on first move, thus it should be called prior to
|
||||
* adding event listeners.
|
||||
*
|
||||
* @param {!Node} node Node to set touch action setting on
|
||||
* @param {!EventTarget} node Node to set touch action setting on
|
||||
* @param {string} value Touch action value
|
||||
* @return {void}
|
||||
*/
|
||||
export function setTouchAction(node, value) {
|
||||
if (HAS_NATIVE_TA) {
|
||||
if (HAS_NATIVE_TA && node instanceof HTMLElement) {
|
||||
// NOTE: add touchAction async so that events can be added in
|
||||
// custom element constructors. Otherwise we run afoul of custom
|
||||
// elements restriction against settings attributes (style) in the
|
||||
|
||||
Reference in New Issue
Block a user