Skip to content

Commit

Permalink
Expand type of LegacyElementMixin#listen and unlisten to accept Event…
Browse files Browse the repository at this point in the history
…Targets.
  • Loading branch information
rictic committed Sep 18, 2018
1 parent 9dbc872 commit b55c56f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/legacy/legacy-element-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,13 @@ export const LegacyElementMixin = dedupingMixin((base) => {
* Convenience method to add an event listener on a given element,
* late bound to a named method on this element.
*
* @param {Element} node Element to add event listener to.
* @param {?EventTarget} node Element to add event listener to.
* @param {string} eventName Name of event to listen for.
* @param {string} methodName Name of handler method on `this` to call.
* @return {void}
*/
listen(node, eventName, methodName) {
node = /** @type {!Element} */ (node || this);
node = /** @type {!EventTarget} */ (node || this);
let hbl = this.__boundListeners ||
(this.__boundListeners = new WeakMap());
let bl = hbl.get(node);
Expand All @@ -434,14 +434,14 @@ export const LegacyElementMixin = dedupingMixin((base) => {
* Convenience method to remove an event listener from a given element,
* late bound to a named method on this element.
*
* @param {Element} node Element to remove event listener from.
* @param {?EventTarget} node Element to remove event listener from.
* @param {string} eventName Name of event to stop listening to.
* @param {string} methodName Name of handler method on `this` to not call
anymore.
* @return {void}
*/
unlisten(node, eventName, methodName) {
node = /** @type {!Element} */ (node || this);
node = /** @type {!EventTarget} */ (node || this);
let bl = this.__boundListeners && this.__boundListeners.get(node);
let key = eventName + methodName;
let handler = bl && bl[key];
Expand Down

0 comments on commit b55c56f

Please sign in to comment.