diff --git a/lib/mixins/dir-mixin.js b/lib/mixins/dir-mixin.js index 0b2326fdc4..1957bb489c 100644 --- a/lib/mixins/dir-mixin.js +++ b/lib/mixins/dir-mixin.js @@ -83,6 +83,9 @@ function takeRecords() { * @mixinFunction * @polymer * @appliesMixin PropertyAccessors + * @template T + * @param {function(new:T)} superClass Class to apply mixin to. + * @return {function(new:T)} superClass with mixin applied. */ export const DirMixin = dedupingMixin((base) => { diff --git a/lib/mixins/disable-upgrade-mixin.js b/lib/mixins/disable-upgrade-mixin.js index 7cb9e894fa..8b2022a6eb 100644 --- a/lib/mixins/disable-upgrade-mixin.js +++ b/lib/mixins/disable-upgrade-mixin.js @@ -38,6 +38,9 @@ const DISABLED_ATTR = 'disable-upgrade'; * @mixinFunction * @polymer * @appliesMixin ElementMixin + * @template T + * @param {function(new:T)} superClass Class to apply mixin to. + * @return {function(new:T)} superClass with mixin applied. */ export const DisableUpgradeMixin = dedupingMixin((base) => { /** diff --git a/lib/mixins/element-mixin.js b/lib/mixins/element-mixin.js index ab10624cc2..522914b33b 100644 --- a/lib/mixins/element-mixin.js +++ b/lib/mixins/element-mixin.js @@ -95,6 +95,9 @@ const builtCSS = window.ShadyCSS && window.ShadyCSS['cssBuild']; * import strategies. * @summary Element class mixin that provides the core API for Polymer's * meta-programming features. + * @template T + * @param {function(new:T)} superClass Class to apply mixin to. + * @return {function(new:T)} superClass with mixin applied. */ export const ElementMixin = dedupingMixin(base => { /** diff --git a/lib/mixins/gesture-event-listeners.js b/lib/mixins/gesture-event-listeners.js index 04dc14fd89..71a4577ff7 100644 --- a/lib/mixins/gesture-event-listeners.js +++ b/lib/mixins/gesture-event-listeners.js @@ -24,65 +24,48 @@ import { addListener, removeListener } from '../utils/gestures.js'; * @mixinFunction * @polymer * @summary Element class mixin that provides API for adding Polymer's - * cross-platform - * gesture events to nodes + * cross-platform gesture events to nodes + * @template T + * @param {function(new:T)} superClass Class to apply mixin to. + * @return {function(new:T)} superClass with mixin applied. */ -const GestureEventListeners = dedupingMixin( +export const GestureEventListeners = dedupingMixin((superClass) => { + /** + * @polymer + * @mixinClass + * @implements {Polymer_GestureEventListeners} + */ + class GestureEventListeners extends superClass { /** - * @template T - * @param {function(new:T)} superClass Class to apply mixin to. - * @return {function(new:T)} superClass with mixin applied. + * Add the event listener to the node if it is a gestures event. + * + * @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} + * @override */ - (superClass) => { - /** - * @polymer - * @mixinClass - * @implements {Polymer_GestureEventListeners} - */ - class GestureEventListeners extends superClass { - /** - * Add the event listener to the node if it is a gestures event. - * - * @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} - * @override - */ - _addEventListenerToNode(node, eventName, handler) { - if (!addListener(node, eventName, handler)) { - super._addEventListenerToNode(node, eventName, handler); - } - } - - /** - * Remove the event listener to the node if it is a gestures event. - * - * @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} - * @override - */ - _removeEventListenerFromNode(node, eventName, handler) { - if (!removeListener(node, eventName, handler)) { - super._removeEventListenerFromNode(node, eventName, handler); - } - } + _addEventListenerToNode(node, eventName, handler) { + if (!addListener(node, eventName, handler)) { + super._addEventListenerToNode(node, eventName, handler); } + } - return GestureEventListeners; - }); - -// Somehow GestureEventListeners is incorrectly typed as *. For now add this -// cast. -/** - * @template T - * @param {function(new:T)} superClass Class to apply mixin to. - * @return {function(new:T)} superClass with mixin applied. - */ -const _GestureEventListeners = function(superClass) { - return GestureEventListeners(superClass); -}; + /** + * Remove the event listener to the node if it is a gestures event. + * + * @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} + * @override + */ + _removeEventListenerFromNode(node, eventName, handler) { + if (!removeListener(node, eventName, handler)) { + super._removeEventListenerFromNode(node, eventName, handler); + } + } + } -export {_GestureEventListeners as GestureEventListeners}; + return GestureEventListeners; +}); diff --git a/lib/mixins/mutable-data.js b/lib/mixins/mutable-data.js index d38b5119b9..12072ac47a 100644 --- a/lib/mixins/mutable-data.js +++ b/lib/mixins/mutable-data.js @@ -67,6 +67,9 @@ function mutablePropertyChange(inst, property, value, old, mutableData) { * @polymer * @summary Element class mixin to skip strict dirty-checking for objects * and arrays + * @template T + * @param {function(new:T)} superClass Class to apply mixin to. + * @return {function(new:T)} superClass with mixin applied. */ export const MutableData = dedupingMixin(superClass => { diff --git a/lib/mixins/properties-changed.js b/lib/mixins/properties-changed.js index 363138b1ac..ff49a5746b 100644 --- a/lib/mixins/properties-changed.js +++ b/lib/mixins/properties-changed.js @@ -33,6 +33,9 @@ const microtask = microTask; * @polymer * @summary Element class mixin for reacting to property changes from * generated property accessors. + * @template T + * @param {function(new:T)} superClass Class to apply mixin to. + * @return {function(new:T)} superClass with mixin applied. */ export const PropertiesChanged = dedupingMixin( /** diff --git a/lib/mixins/properties-mixin.js b/lib/mixins/properties-mixin.js index d450cfd299..06fe449d38 100644 --- a/lib/mixins/properties-mixin.js +++ b/lib/mixins/properties-mixin.js @@ -47,6 +47,9 @@ function normalizeProperties(props) { * @appliesMixin PropertiesChanged * @summary Mixin that provides a minimal starting point for using * the PropertiesChanged mixin by providing a declarative `properties` object. + * @template T + * @param {function(new:T)} superClass Class to apply mixin to. + * @return {function(new:T)} superClass with mixin applied. */ export const PropertiesMixin = dedupingMixin(superClass => { diff --git a/lib/mixins/property-accessors.js b/lib/mixins/property-accessors.js index 16d039ef82..2590165c03 100644 --- a/lib/mixins/property-accessors.js +++ b/lib/mixins/property-accessors.js @@ -91,6 +91,9 @@ function saveAccessorValue(model, property) { * @appliesMixin PropertiesChanged * @summary Element class mixin for reacting to property changes from * generated property accessors. + * @template T + * @param {function(new:T)} superClass Class to apply mixin to. + * @return {function(new:T)} superClass with mixin applied. */ export const PropertyAccessors = dedupingMixin(superClass => { diff --git a/lib/mixins/property-effects.js b/lib/mixins/property-effects.js index 3affb2661b..af8968606a 100644 --- a/lib/mixins/property-effects.js +++ b/lib/mixins/property-effects.js @@ -1079,6 +1079,9 @@ function upper(name) { * @appliesMixin PropertyAccessors * @summary Element class mixin that provides meta-programming for Polymer's * template binding and data observation system. + * @template T + * @param {function(new:T)} superClass Class to apply mixin to. + * @return {function(new:T)} superClass with mixin applied. */ export const PropertyEffects = dedupingMixin(superClass => { diff --git a/lib/mixins/strict-binding-parser.js b/lib/mixins/strict-binding-parser.js index 924c69c70f..6027fee112 100644 --- a/lib/mixins/strict-binding-parser.js +++ b/lib/mixins/strict-binding-parser.js @@ -115,6 +115,9 @@ function storeMethodNumber(bindingData, text, i) { * @appliesMixin PropertyEffects * @polymer * @summary Mixin that parses binding expressions and generates corresponding metadata. + * @template T + * @param {function(new:T)} superClass Class to apply mixin to. + * @return {function(new:T)} superClass with mixin applied. */ const StrictBindingParser = dedupingMixin((base) => { diff --git a/lib/mixins/template-stamp.js b/lib/mixins/template-stamp.js index 99313a1165..e7a576ec2a 100644 --- a/lib/mixins/template-stamp.js +++ b/lib/mixins/template-stamp.js @@ -104,6 +104,9 @@ function createNodeEventHandler(context, eventName, methodName) { * @mixinFunction * @polymer * @summary Element class mixin that provides basic template parsing and stamping + * @template T + * @param {function(new:T)} superClass Class to apply mixin to. + * @return {function(new:T)} superClass with mixin applied. */ export const TemplateStamp = dedupingMixin( /**