diff --git a/externs/closure-types.js b/externs/closure-types.js index 5f243df172..dd404bce5b 100644 --- a/externs/closure-types.js +++ b/externs/closure-types.js @@ -19,29 +19,33 @@ function Polymer_PropertiesChanged(){} * @param {string} property Name of the property * @param {boolean=} readOnly When true, no setter is created; the protected `_setProperty` function must be used to set the property +* @return {void} */ Polymer_PropertiesChanged.prototype._createPropertyAccessor = function(property, readOnly){}; /** * @param {string} property Name of the property * @param {boolean=} readOnly When true, no setter is created +* @return {void} */ Polymer_PropertiesChanged.prototype._definePropertyAccessor = function(property, readOnly){}; /** -* @return {undefined} +* @return {void} */ Polymer_PropertiesChanged.prototype.ready = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_PropertiesChanged.prototype._initializeProperties = function(){}; /** * @param {Object} props Bag of property values that were overwritten when creating property accessors. +* @return {void} */ Polymer_PropertiesChanged.prototype._initializeInstanceProperties = function(props){}; /** * @param {string} property Name of the property * @param {*} value Value to set +* @return {void} */ Polymer_PropertiesChanged.prototype._setProperty = function(property, value){}; /** @@ -57,15 +61,15 @@ Polymer_PropertiesChanged.prototype._getProperty = function(property){}; */ Polymer_PropertiesChanged.prototype._setPendingProperty = function(property, value, ext){}; /** -* @return {undefined} +* @return {void} */ Polymer_PropertiesChanged.prototype._invalidateProperties = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_PropertiesChanged.prototype._enableProperties = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_PropertiesChanged.prototype._flushProperties = function(){}; /** @@ -74,6 +78,7 @@ Polymer_PropertiesChanged.prototype._flushProperties = function(){}; call to `_propertiesChanged` * @param {!Object} oldProps Bag of previous values for each property in `changedProps` +* @return {void} */ Polymer_PropertiesChanged.prototype._propertiesChanged = function(currentProps, changedProps, oldProps){}; /** @@ -87,6 +92,7 @@ Polymer_PropertiesChanged.prototype._shouldPropertyChange = function(property, v * @param {string} name Name of attribute that changed * @param {?string} old Old attribute value * @param {?string} value New attribute value +* @return {void} */ Polymer_PropertiesChanged.prototype.attributeChangedCallback = function(name, old, value){}; /** @@ -94,23 +100,26 @@ Polymer_PropertiesChanged.prototype.attributeChangedCallback = function(name, ol * @param {?string} value of the attribute. * @param {*=} type type to deserialize to, defaults to the value returned from `typeForProperty` +* @return {void} */ Polymer_PropertiesChanged.prototype._attributeToProperty = function(attribute, value, type){}; /** * @param {string} property Property name to reflect. * @param {string=} attribute Attribute name to reflect to. * @param {*=} value Property value to refect. +* @return {void} */ Polymer_PropertiesChanged.prototype._propertyToAttribute = function(property, attribute, value){}; /** * @param {Element} node Element to set attribute to. * @param {*} value Value to serialize. * @param {string} attribute Attribute name to serialize to. +* @return {void} */ Polymer_PropertiesChanged.prototype._valueToNodeAttribute = function(node, value, attribute){}; /** * @param {*} value Property value to serialize. -* @return {(string|undefined)} +* @return {(string | undefined)} */ Polymer_PropertiesChanged.prototype._serializeValue = function(value){}; /** @@ -156,7 +165,7 @@ Polymer_PropertyAccessors.prototype._definePropertyAccessor = function(property, Polymer_PropertyAccessors.prototype._initializeProperties = function(){}; /** * @param {*} value Property value to serialize. -* @return {(string|undefined)} +* @return {(string | undefined)} */ Polymer_PropertyAccessors.prototype._serializeValue = function(value){}; /** @@ -206,7 +215,7 @@ function Polymer_TemplateStamp(){} */ Polymer_TemplateStamp.prototype._stampTemplate = function(template){}; /** -* @param {Node} node Node to add listener on +* @param {!Node} 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 @@ -215,7 +224,7 @@ Polymer_TemplateStamp.prototype._stampTemplate = function(template){}; */ Polymer_TemplateStamp.prototype._addMethodEventListenerToNode = function(node, eventName, methodName, context){}; /** -* @param {Node} node Node to add event listener to +* @param {!Node} node Node to add event listener to * @param {string} eventName Name of event * @param {Function} handler Listener function to add * @return {void} @@ -355,19 +364,24 @@ Polymer_PropertyEffects.prototype.__templateInfo; Polymer_PropertyEffects.prototype._stampTemplate = function(template){}; /** * @override +* @return {void} */ Polymer_PropertyEffects.prototype.ready = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_PropertyEffects.prototype._initializeProperties = function(){}; /** * @override * @param {Object} props Properties to initialize on the instance +* @return {void} */ Polymer_PropertyEffects.prototype._initializeInstanceProperties = function(props){}; /** * @override +* @param {string} property Name of the property +* @param {*} value Value to set +* @return {void} */ Polymer_PropertyEffects.prototype._setProperty = function(property, value){}; /** @@ -381,19 +395,26 @@ Polymer_PropertyEffects.prototype._setProperty = function(property, value){}; Polymer_PropertyEffects.prototype._setPendingProperty = function(property, value, shouldNotify){}; /** * @override +* @return {void} */ Polymer_PropertyEffects.prototype._invalidateProperties = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_PropertyEffects.prototype._flushProperties = function(){}; /** -* @override +* @param {!Object} currentProps Bag of all current accessor values +* @param {!Object} changedProps Bag of properties changed since the last + call to `_propertiesChanged` +* @param {!Object} oldProps Bag of previous values for each property + in `changedProps` +* @return {void} */ Polymer_PropertyEffects.prototype._propertiesChanged = function(currentProps, changedProps, oldProps){}; /** * @override * @param {Object} props Properties to initialize on the prototype +* @return {void} */ Polymer_PropertyEffects.prototype._initializeProtoProperties = function(props){}; /** @@ -437,7 +458,7 @@ Polymer_PropertyEffects.prototype._hasReflectEffect = function(property){}; */ Polymer_PropertyEffects.prototype._hasComputedEffect = function(property){}; /** -* @param {(string|!Array.<(number|string)>)} path Path to set +* @param {(string | !Array.<(number | string)>)} path Path to set * @param {*} value Value to set * @param {boolean=} shouldNotify Set to true if this change should cause a property notification event dispatch @@ -486,13 +507,13 @@ Polymer_PropertyEffects.prototype.setProperties = function(props, setReadOnly){} */ Polymer_PropertyEffects.prototype._propagatePropertyChanges = function(changedProps, oldProps, hasPaths){}; /** -* @param {(string|!Array.<(string|number)>)} to Target path to link. -* @param {(string|!Array.<(string|number)>)} from Source path to link. +* @param {(string | !Array.<(string | number)>)} to Target path to link. +* @param {(string | !Array.<(string | number)>)} from Source path to link. * @return {void} */ Polymer_PropertyEffects.prototype.linkPaths = function(to, from){}; /** -* @param {(string|!Array.<(string|number)>)} path Target path to unlink. +* @param {(string | !Array.<(string | number)>)} path Target path to unlink. * @return {void} */ Polymer_PropertyEffects.prototype.unlinkPaths = function(path){}; @@ -514,7 +535,7 @@ Polymer_PropertyEffects.prototype.unlinkPaths = function(path){}; */ Polymer_PropertyEffects.prototype.notifySplices = function(path, splices){}; /** -* @param {(string|!Array.<(string|number)>)} path Path to the value +* @param {(string | !Array.<(string | number)>)} path Path to the value to read. The path may be specified as a string (e.g. `foo.bar.baz`) or an array of path parts (e.g. `['foo.bar', 'baz']`). Note that bracketed expressions are not supported; string-based path parts @@ -526,7 +547,7 @@ Polymer_PropertyEffects.prototype.notifySplices = function(path, splices){}; */ Polymer_PropertyEffects.prototype.get = function(path, root){}; /** -* @param {(string|!Array.<(string|number)>)} path Path to the value +* @param {(string | !Array.<(string | number)>)} path Path to the value to write. The path may be specified as a string (e.g. `'foo.bar.baz'`) or an array of path parts (e.g. `['foo.bar', 'baz']`). Note that bracketed expressions are not supported; string-based path parts @@ -540,32 +561,32 @@ Polymer_PropertyEffects.prototype.get = function(path, root){}; */ Polymer_PropertyEffects.prototype.set = function(path, value, root){}; /** -* @param {(string|!Array.<(string|number)>)} path Path to array. -* @param {...*} items +* @param {(string | !Array.<(string | number)>)} path Path to array. +* @param {...*} items Items to push onto array * @return {number} */ Polymer_PropertyEffects.prototype.push = function(path, items){}; /** -* @param {(string|!Array.<(string|number)>)} path Path to array. +* @param {(string | !Array.<(string | number)>)} path Path to array. * @return {*} */ Polymer_PropertyEffects.prototype.pop = function(path){}; /** -* @param {(string|!Array.<(string|number)>)} path Path to array. +* @param {(string | !Array.<(string | number)>)} path Path to array. * @param {number} start Index from which to start removing/inserting. * @param {number} deleteCount Number of items to remove. -* @param {...*} items +* @param {...*} items Items to insert into array. * @return {Array} */ Polymer_PropertyEffects.prototype.splice = function(path, start, deleteCount, items){}; /** -* @param {(string|!Array.<(string|number)>)} path Path to array. +* @param {(string | !Array.<(string | number)>)} path Path to array. * @return {*} */ Polymer_PropertyEffects.prototype.shift = function(path){}; /** -* @param {(string|!Array.<(string|number)>)} path Path to array. -* @param {...*} items +* @param {(string | !Array.<(string | number)>)} path Path to array. +* @param {...*} items Items to insert info array * @return {number} */ Polymer_PropertyEffects.prototype.unshift = function(path, items){}; @@ -584,7 +605,7 @@ Polymer_PropertyEffects.prototype.notifyPath = function(path, value){}; Polymer_PropertyEffects.prototype._createReadOnlyProperty = function(property, protectedSetter){}; /** * @param {string} property Property name -* @param {(string|function (*, *))} method Function or name of observer method to call +* @param {(string | function (*, *))} method Function or name of observer method to call * @param {boolean=} dynamicFn Whether the method name should be included as a dependency to the effect. * @return {void} @@ -592,7 +613,7 @@ Polymer_PropertyEffects.prototype._createReadOnlyProperty = function(property, p Polymer_PropertyEffects.prototype._createPropertyObserver = function(property, method, dynamicFn){}; /** * @param {string} expression Method expression -* @param {(boolean|Object)=} dynamicFn Boolean or object map indicating +* @param {(boolean | Object)=} dynamicFn Boolean or object map indicating whether method names should be included as a dependency to the effect. * @return {void} */ @@ -610,7 +631,7 @@ Polymer_PropertyEffects.prototype._createReflectedProperty = function(property){ /** * @param {string} property Name of computed property to set * @param {string} expression Method expression -* @param {(boolean|Object)=} dynamicFn Boolean or object map indicating +* @param {(boolean | Object)=} dynamicFn Boolean or object map indicating whether method names should be included as a dependency to the effect. * @return {void} */ @@ -667,7 +688,7 @@ Polymer_PropertyEffects._parseTemplateNodeAttribute = function(node, templateInf Polymer_PropertyEffects.addPropertyEffect = function(property, type, effect){}; /** * @param {string} property Property name -* @param {(string|function (*, *))} method Function or name of observer method to call +* @param {(string | function (*, *))} method Function or name of observer method to call * @param {boolean=} dynamicFn Whether the method name should be included as a dependency to the effect. * @return {void} @@ -675,7 +696,7 @@ Polymer_PropertyEffects.addPropertyEffect = function(property, type, effect){}; Polymer_PropertyEffects.createPropertyObserver = function(property, method, dynamicFn){}; /** * @param {string} expression Method expression -* @param {(boolean|Object)=} dynamicFn Boolean or object map indicating +* @param {(boolean | Object)=} dynamicFn Boolean or object map indicating * @return {void} */ Polymer_PropertyEffects.createMethodObserver = function(expression, dynamicFn){}; @@ -699,7 +720,7 @@ Polymer_PropertyEffects.createReflectedProperty = function(property){}; /** * @param {string} property Name of computed property to set * @param {string} expression Method expression -* @param {(boolean|Object)=} dynamicFn Boolean or object map indicating whether +* @param {(boolean | Object)=} dynamicFn Boolean or object map indicating whether method names should be included as a dependency to the effect. * @return {void} */ @@ -741,14 +762,15 @@ Polymer_PropertyEffects._evaluateBinding = function(inst, part, path, props, old function Polymer_PropertiesMixin(){} /** * @override +* @return {void} */ Polymer_PropertiesMixin.prototype._initializeProperties = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_PropertiesMixin.prototype.connectedCallback = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_PropertiesMixin.prototype.disconnectedCallback = function(){}; /** @@ -782,7 +804,7 @@ Polymer_ElementMixin.prototype.rootPath; /** @type {string} */ Polymer_ElementMixin.prototype.importPath; -/** @type {(StampedTemplate|HTMLElement|ShadowRoot)} */ +/** @type {(StampedTemplate | HTMLElement | ShadowRoot)} */ Polymer_ElementMixin.prototype.root; /** @type {!Object.} */ @@ -790,18 +812,21 @@ Polymer_ElementMixin.prototype.$; /** * @override +* @return {void} */ Polymer_ElementMixin.prototype.ready = function(){}; /** * @override +* @return {void} */ Polymer_ElementMixin.prototype._initializeProperties = function(){}; /** * @override +* @return {void} */ Polymer_ElementMixin.prototype._readyClients = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_ElementMixin.prototype.connectedCallback = function(){}; /** @@ -861,15 +886,17 @@ Polymer_ElementMixin._finalizeTemplate = function(is){}; */ function Polymer_GestureEventListeners(){} /** -* @param {*} node -* @param {*} eventName -* @param {*} handler +* @param {!Node} node Node to add event listener to +* @param {string} eventName Name of event +* @param {Function} handler Listener function to add +* @return {void} */ Polymer_GestureEventListeners.prototype._addEventListenerToNode = function(node, eventName, handler){}; /** -* @param {*} node -* @param {*} eventName -* @param {*} handler +* @param {!Node} node Node to remove event listener from +* @param {string} eventName Name of event +* @param {Function} handler Listener function to remove +* @return {void} */ Polymer_GestureEventListeners.prototype._removeEventListenerFromNode = function(node, eventName, handler){}; /** @@ -881,15 +908,15 @@ function Polymer_DirMixin(){} Polymer_DirMixin.prototype.__autoDirOptOut; /** -* @return {undefined} +* @return {void} */ Polymer_DirMixin.prototype.ready = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_DirMixin.prototype.connectedCallback = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_DirMixin.prototype.disconnectedCallback = function(){}; /** @@ -918,10 +945,12 @@ Polymer_LegacyElementMixin.prototype._debouncers; /** * @override +* @return {void} */ Polymer_LegacyElementMixin.prototype.ready = function(){}; /** * @override +* @return {void} */ Polymer_LegacyElementMixin.prototype._initializeProperties = function(){}; /** @@ -929,49 +958,53 @@ Polymer_LegacyElementMixin.prototype._initializeProperties = function(){}; * @param {string} name Name of attribute. * @param {?string} old Old value of attribute. * @param {?string} value Current value of attribute. +* @return {void} */ Polymer_LegacyElementMixin.prototype.attributeChangedCallback = function(name, old, value){}; /** * @override +* @return {void} */ Polymer_LegacyElementMixin.prototype.connectedCallback = function(){}; /** * @override +* @return {void} */ Polymer_LegacyElementMixin.prototype.disconnectedCallback = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_LegacyElementMixin.prototype.created = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_LegacyElementMixin.prototype.attached = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_LegacyElementMixin.prototype.detached = function(){}; /** * @param {string} name Name of attribute. * @param {?string} old Old value of attribute. * @param {?string} value Current value of attribute. +* @return {void} */ Polymer_LegacyElementMixin.prototype.attributeChanged = function(name, old, value){}; /** -* @return {undefined} +* @return {void} */ Polymer_LegacyElementMixin.prototype._registered = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_LegacyElementMixin.prototype._ensureAttributes = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_LegacyElementMixin.prototype._applyListeners = function(){}; /** * @param {*} value Value to deserialize -* @return {(string|undefined)} +* @return {(string | undefined)} */ Polymer_LegacyElementMixin.prototype.serialize = function(value){}; /** @@ -1022,7 +1055,7 @@ Polymer_LegacyElementMixin.prototype.instanceTemplate = function(template){}; * @param {string} type Name of event type. * @param {*=} detail Detail value containing event-specific payload. -* @param {{bubbles: (boolean|undefined), cancelable: (boolean|undefined), composed: (boolean|undefined)}=} options Object specifying options. These may include: +* @param {{bubbles: (boolean | undefined), cancelable: (boolean | undefined), composed: (boolean | undefined)}=} options Object specifying options. These may include: `bubbles` (boolean, defaults to `true`), `cancelable` (boolean, defaults to false), and `node` on which to fire the event (HTMLElement, defaults to `this`). @@ -1062,16 +1095,16 @@ Polymer_LegacyElementMixin.prototype.$$ = function(slctr){}; */ Polymer_LegacyElementMixin.prototype.distributeContent = function(){}; /** -* @return {Array.} +* @return {!Array.} */ Polymer_LegacyElementMixin.prototype.getEffectiveChildNodes = function(){}; /** * @param {string} selector Selector to run. -* @return {Array.} +* @return {!Array.} */ Polymer_LegacyElementMixin.prototype.queryDistributedElements = function(selector){}; /** -* @return {Array.} +* @return {!Array.} */ Polymer_LegacyElementMixin.prototype.getEffectiveChildren = function(){}; /** @@ -1085,19 +1118,19 @@ Polymer_LegacyElementMixin.prototype.getEffectiveTextContent = function(){}; Polymer_LegacyElementMixin.prototype.queryEffectiveChildren = function(selector){}; /** * @param {string} selector Selector to run. -* @return {Array.} +* @return {!Array.} */ Polymer_LegacyElementMixin.prototype.queryAllEffectiveChildren = function(selector){}; /** * @param {string=} slctr CSS selector to choose the desired ``. Defaults to `content`. -* @return {Array.} +* @return {!Array.} */ Polymer_LegacyElementMixin.prototype.getContentChildNodes = function(slctr){}; /** * @param {string=} slctr CSS selector to choose the desired ``. Defaults to `content`. -* @return {Array.} +* @return {!Array.} */ Polymer_LegacyElementMixin.prototype.getContentChildren = function(slctr){}; /** @@ -1111,8 +1144,9 @@ Polymer_LegacyElementMixin.prototype.isLightDescendant = function(node){}; */ Polymer_LegacyElementMixin.prototype.isLocalDescendant = function(node){}; /** -* @param {*} container -* @param {*} shouldObserve +* @param {*} container Unused +* @param {*} shouldObserve Unused +* @return {void} */ Polymer_LegacyElementMixin.prototype.scopeSubtree = function(container, shouldObserve){}; /** @@ -1122,7 +1156,7 @@ Polymer_LegacyElementMixin.prototype.scopeSubtree = function(container, shouldOb Polymer_LegacyElementMixin.prototype.getComputedStyleValue = function(property){}; /** * @param {string} jobName String to identify the debounce job. -* @param {function ()} callback Function that is called (with `this` +* @param {function (): void} callback Function that is called (with `this` context) when the wait time elapses. * @param {number} wait Optional wait time in milliseconds (ms) after the last signal that must elapse before invoking `callback` @@ -1173,7 +1207,7 @@ Polymer_LegacyElementMixin.prototype.create = function(tag, props){}; unsuccessfully loaded. * @param {boolean=} optAsync True if the import should be loaded `async`. Defaults to `false`. -* @return {HTMLLinkElement} +* @return {!HTMLLinkElement} */ Polymer_LegacyElementMixin.prototype.importHref = function(href, onload, onerror, optAsync){}; /** @@ -1187,6 +1221,7 @@ Polymer_LegacyElementMixin.prototype.elementMatches = function(selector, node){} * @param {boolean=} bool Boolean to force the attribute on or off. When unspecified, the state of the attribute will be reversed. * @param {Element=} node Node to target. Defaults to `this`. +* @return {void} */ Polymer_LegacyElementMixin.prototype.toggleAttribute = function(name, bool, node){}; /** @@ -1194,6 +1229,7 @@ Polymer_LegacyElementMixin.prototype.toggleAttribute = function(name, bool, node * @param {boolean=} bool Boolean to force the class on or off. When unspecified, the state of the class will be reversed. * @param {Element=} node Node to target. Defaults to `this`. +* @return {void} */ Polymer_LegacyElementMixin.prototype.toggleClass = function(name, bool, node){}; /** @@ -1213,7 +1249,7 @@ Defaults to `this`. */ Polymer_LegacyElementMixin.prototype.translate3d = function(x, y, z, node){}; /** -* @param {(string|!Array.<(number|string)>)} arrayOrPath Path to array from which to remove the item +* @param {(string | !Array.<(number | string)>)} arrayOrPath Path to array from which to remove the item (or the array itself). * @param {*} item Item to remove. * @return {Array} @@ -1222,23 +1258,27 @@ Polymer_LegacyElementMixin.prototype.arrayDelete = function(arrayOrPath, item){} /** * @param {string} level One of 'log', 'warn', 'error' * @param {Array} args Array of strings or objects to log +* @return {void} */ Polymer_LegacyElementMixin.prototype._logger = function(level, args){}; /** -* @param {...*} args +* @param {...*} args Array of strings or objects to log +* @return {void} */ Polymer_LegacyElementMixin.prototype._log = function(args){}; /** -* @param {...*} args +* @param {...*} args Array of strings or objects to log +* @return {void} */ Polymer_LegacyElementMixin.prototype._warn = function(args){}; /** -* @param {...*} args +* @param {...*} args Array of strings or objects to log +* @return {void} */ Polymer_LegacyElementMixin.prototype._error = function(args){}; /** * @param {string} methodName Method name to associate with message -* @param {...*} args +* @param {...*} args Array of strings or objects to log * @return {Array} */ Polymer_LegacyElementMixin.prototype._logf = function(methodName, args){}; @@ -1278,7 +1318,7 @@ Polymer_ArraySelectorMixin.prototype.items; /** @type {boolean} */ Polymer_ArraySelectorMixin.prototype.multi; -/** @type {?(Object|Array.)} */ +/** @type {?(Object | Array.)} */ Polymer_ArraySelectorMixin.prototype.selected; /** @type {?Object} */ @@ -1288,7 +1328,7 @@ Polymer_ArraySelectorMixin.prototype.selectedItem; Polymer_ArraySelectorMixin.prototype.toggle; /** -* @return {undefined} +* @return {void} */ Polymer_ArraySelectorMixin.prototype.clearSelection = function(){}; /** @@ -1320,4 +1360,4 @@ Polymer_ArraySelectorMixin.prototype.select = function(item){}; * @param {number} idx Index from `items` array to select * @return {void} */ -Polymer_ArraySelectorMixin.prototype.selectIndex = function(idx){}; +Polymer_ArraySelectorMixin.prototype.selectIndex = function(idx){}; \ No newline at end of file diff --git a/externs/polymer-internal-shared-types.js b/externs/polymer-internal-shared-types.js index 525aaae7a1..274f60351d 100644 --- a/externs/polymer-internal-shared-types.js +++ b/externs/polymer-internal-shared-types.js @@ -161,5 +161,5 @@ let TemplatizeOptions; function AsyncInterface(){} /** @type {function(!Function, number=): number} */ AsyncInterface.prototype.run; -/** @type {function(number)} */ -AsyncInterface.prototype.cancel; \ No newline at end of file +/** @type {function(number): void} */ +AsyncInterface.prototype.cancel; diff --git a/gulpfile.js b/gulpfile.js index ab3ff6028c..e705fa5832 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -113,7 +113,7 @@ class AddClosureTypeImport extends Transform { gulp.task('clean', () => del([DIST_DIR, 'closure.log'])); -gulp.task('closure', ['clean'], () => { +gulp.task('closure', ['generate-externs'], () => { let entry, splitRx, joinRx, addClosureTypes; diff --git a/lib/elements/dom-if.html b/lib/elements/dom-if.html index 9da7f11356..d6ad8ca736 100644 --- a/lib/elements/dom-if.html +++ b/lib/elements/dom-if.html @@ -117,6 +117,9 @@ Polymer.enqueueDebouncer(this.__renderDebouncer); } + /** + * @return {void} + */ disconnectedCallback() { super.disconnectedCallback(); if (!this.parentNode || @@ -126,6 +129,9 @@ } } + /** + * @return {void} + */ connectedCallback() { super.connectedCallback(); this.style.display = 'none'; @@ -258,6 +264,13 @@ } } + /** + * Shows or hides the template instance top level child elements. For + * text nodes, `textContent` is removed while "hidden" and replaced when + * "shown." + * @return {void} + * @protected + */ _showHideChildren() { let hidden = this.__hideTemplateChildren__ || !this.if; if (this.__instance) { diff --git a/lib/elements/dom-repeat.html b/lib/elements/dom-repeat.html index ec62e6a87c..01b2e1a726 100644 --- a/lib/elements/dom-repeat.html +++ b/lib/elements/dom-repeat.html @@ -296,6 +296,9 @@ this.template = null; } + /** + * @return {void} + */ disconnectedCallback() { super.disconnectedCallback(); this.__isDetached = true; @@ -304,6 +307,9 @@ } } + /** + * @return {void} + */ connectedCallback() { super.connectedCallback(); this.style.display = 'none'; @@ -617,6 +623,15 @@ } // Implements extension point from Templatize mixin + /** + * Shows or hides the template instance top level child elements. For + * text nodes, `textContent` is removed while "hidden" and replaced when + * "shown." + * @param {boolean} hidden Set to true to hide the children; + * set to false to show them. + * @return {void} + * @protected + */ _showHideChildren(hidden) { for (let i=0; i \ No newline at end of file + diff --git a/lib/mixins/element-mixin.html b/lib/mixins/element-mixin.html index fa983bddd6..0a4c930145 100644 --- a/lib/mixins/element-mixin.html +++ b/lib/mixins/element-mixin.html @@ -443,6 +443,7 @@ * It also initializes any property defaults provided via `value` in * `properties` metadata. * + * @return {void} * @override * @suppress {invalidCasts} */ @@ -525,6 +526,7 @@ * when using the ShadyCSS scoping/custom properties polyfill. * * @suppress {missingProperties, invalidCasts} Super may or may not implement the callback + * @return {void} */ connectedCallback() { if (window.ShadyCSS && this._template) { @@ -536,6 +538,7 @@ /** * Stamps the element template. * + * @return {void} * @override */ ready() { @@ -553,6 +556,7 @@ * client dom to be attached to the element prior to any observers * running. * + * @return {void} * @override */ _readyClients() { diff --git a/lib/mixins/gesture-event-listeners.html b/lib/mixins/gesture-event-listeners.html index 1a63efa182..105e2fade3 100644 --- a/lib/mixins/gesture-event-listeners.html +++ b/lib/mixins/gesture-event-listeners.html @@ -45,12 +45,28 @@ */ class GestureEventListeners extends superClass { + /** + * Add the event listener to the node if it is a gestures event. + * + * @param {!Node} node Node to add event listener to + * @param {string} eventName Name of event + * @param {Function} handler Listener function to add + * @return {void} + */ _addEventListenerToNode(node, eventName, handler) { if (!gestures.addListener(node, eventName, handler)) { super._addEventListenerToNode(node, eventName, handler); } } + /** + * Remove the event listener to the node if it is a gestures event. + * + * @param {!Node} node Node to remove event listener from + * @param {string} eventName Name of event + * @param {Function} handler Listener function to remove + * @return {void} + */ _removeEventListenerFromNode(node, eventName, handler) { if (!gestures.removeListener(node, eventName, handler)) { super._removeEventListenerFromNode(node, eventName, handler); diff --git a/lib/mixins/properties-changed.html b/lib/mixins/properties-changed.html index 195ffc8cde..066f572d95 100644 --- a/lib/mixins/properties-changed.html +++ b/lib/mixins/properties-changed.html @@ -103,6 +103,7 @@ * @param {string} property Name of the property * @param {boolean=} readOnly When true, no setter is created; the * protected `_setProperty` function must be used to set the property + * @return {void} * @protected */ _createPropertyAccessor(property, readOnly) { @@ -124,6 +125,7 @@ * Defines a property accessor for the given property. * @param {string} property Name of the property * @param {boolean=} readOnly When true, no setter is created + * @return {void} */ _definePropertyAccessor(property, readOnly) { Object.defineProperty(this, property, { @@ -164,6 +166,7 @@ * bindings. `super.ready()` must be called to ensure the data system * becomes enabled. * + * @return {void} * @public */ ready() { @@ -177,6 +180,7 @@ * Provided as an override point for performing any setup work prior * to initializing the property accessor system. * + * @return {void} * @protected */ _initializeProperties() { @@ -202,6 +206,7 @@ * * @param {Object} props Bag of property values that were overwritten * when creating property accessors. + * @return {void} * @protected */ _initializeInstanceProperties(props) { @@ -214,6 +219,7 @@ * * @param {string} property Name of the property * @param {*} value Value to set + * @return {void} * @protected */ _setProperty(property, value) { @@ -268,6 +274,7 @@ * Marks the properties as invalid, and enqueues an async * `_propertiesChanged` callback. * + * @return {void} * @protected */ _invalidateProperties() { @@ -290,6 +297,7 @@ * It is safe to call this method multiple times as it only turns on * property accessors once. * + * @return {void} * @protected */ _enableProperties() { @@ -309,7 +317,7 @@ * set), and resets the pending set of changes. Generally, this method * should not be called in user code. * - * + * @return {void} * @protected */ _flushProperties() { @@ -329,6 +337,7 @@ * call to `_propertiesChanged` * @param {!Object} oldProps Bag of previous values for each property * in `changedProps` + * @return {void} * @protected */ _propertiesChanged(currentProps, changedProps, oldProps) { // eslint-disable-line no-unused-vars @@ -369,6 +378,7 @@ * @param {string} name Name of attribute that changed * @param {?string} old Old attribute value * @param {?string} value New attribute value + * @return {void} * @suppress {missingProperties} Super may or may not implement the callback */ attributeChangedCallback(name, old, value) { @@ -390,6 +400,7 @@ * @param {?string} value of the attribute. * @param {*=} type type to deserialize to, defaults to the value * returned from `typeForProperty` + * @return {void} */ _attributeToProperty(attribute, value, type) { if (!this.__serializing) { @@ -408,6 +419,7 @@ * @param {string} property Property name to reflect. * @param {string=} attribute Attribute name to reflect to. * @param {*=} value Property value to refect. + * @return {void} */ _propertyToAttribute(property, attribute, value) { this.__serializing = true; @@ -428,6 +440,7 @@ * @param {Element} node Element to set attribute to. * @param {*} value Value to serialize. * @param {string} attribute Attribute name to serialize to. + * @return {void} */ _valueToNodeAttribute(node, value, attribute) { const str = this._serializeValue(value); @@ -490,4 +503,4 @@ })(); - \ No newline at end of file + diff --git a/lib/mixins/properties-mixin.html b/lib/mixins/properties-mixin.html index 2298799b1d..ec069f26e6 100644 --- a/lib/mixins/properties-mixin.html +++ b/lib/mixins/properties-mixin.html @@ -181,6 +181,7 @@ * Overrides `PropertiesChanged` method and adds a call to * `finalize` which lazily configures the element's property accessors. * @override + * @return {void} */ _initializeProperties() { this.constructor.finalize(); @@ -192,6 +193,7 @@ * Calls `_enableProperties` to turn on property system from * `PropertiesChanged`. * @suppress {missingProperties} Super may or may not implement the callback + * @return {void} */ connectedCallback() { if (super.connectedCallback) { @@ -203,6 +205,7 @@ /** * Called when the element is removed from a document * @suppress {missingProperties} Super may or may not implement the callback + * @return {void} */ disconnectedCallback() { if (super.disconnectedCallback) { diff --git a/lib/mixins/property-effects.html b/lib/mixins/property-effects.html index 8c26892f02..8b2fc689a4 100644 --- a/lib/mixins/property-effects.html +++ b/lib/mixins/property-effects.html @@ -1180,6 +1180,9 @@ return TYPES; } + /** + * @return {void} + */ _initializeProperties() { super._initializeProperties(); hostStack.registerHost(this); @@ -1202,6 +1205,7 @@ * * @override * @param {Object} props Properties to initialize on the prototype + * @return {void} */ _initializeProtoProperties(props) { this.__data = Object.create(props); @@ -1215,6 +1219,7 @@ * * @override * @param {Object} props Properties to initialize on the instance + * @return {void} */ _initializeInstanceProperties(props) { let readOnly = this[TYPES.READ_ONLY]; @@ -1494,6 +1499,9 @@ * to true, for per-property notification tracking. * * @override + * @param {string} property Name of the property + * @param {*} value Value to set + * @return {void} */ _setProperty(property, value) { if (this._setPendingProperty(property, value, true)) { @@ -1508,6 +1516,7 @@ * `_propertiesChanged` synchronously. * * @override + * @return {void} */ _invalidateProperties() { if (this.__dataReady) { @@ -1534,6 +1543,7 @@ /** * Overrides superclass implementation. * + * @return {void} * @protected */ _flushProperties() { @@ -1636,6 +1646,7 @@ * that was not enabled as a result of flushing properties. * * @override + * @return {void} */ ready() { // It is important that `super.ready()` is not called here as it @@ -1661,7 +1672,12 @@ * Runs each class of effects for the batch of changed properties in * a specific order (compute, propagate, reflect, observe, notify). * - * @override + * @param {!Object} currentProps Bag of all current accessor values + * @param {!Object} changedProps Bag of properties changed since the last + * call to `_propertiesChanged` + * @param {!Object} oldProps Bag of previous values for each property + * in `changedProps` + * @return {void} */ _propertiesChanged(currentProps, changedProps, oldProps) { // ---------------------------- diff --git a/lib/mixins/template-stamp.html b/lib/mixins/template-stamp.html index a8cf993534..fd01f406b3 100644 --- a/lib/mixins/template-stamp.html +++ b/lib/mixins/template-stamp.html @@ -443,7 +443,7 @@ * This method generates a handler function that looks up the method * name at handling time. * - * @param {Node} node Node to add listener on + * @param {!Node} 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 @@ -460,7 +460,7 @@ /** * Override point for adding custom or simulated event handling. * - * @param {Node} node Node to add event listener to + * @param {!Node} node Node to add event listener to * @param {string} eventName Name of event * @param {Function} handler Listener function to add * @return {void} diff --git a/lib/utils/flattened-nodes-observer.html b/lib/utils/flattened-nodes-observer.html index 9ea217fc70..e08d08cab3 100644 --- a/lib/utils/flattened-nodes-observer.html +++ b/lib/utils/flattened-nodes-observer.html @@ -16,7 +16,7 @@ /** * Returns true if `node` is a slot element - * @param {HTMLElement} node Node to test. + * @param {Node} node Node to test. * @return {boolean} Returns true if the given `node` is a slot * @private */ @@ -97,7 +97,7 @@ } /** - * @param {Node} target Node on which to listen for changes. + * @param {Element} target Node on which to listen for changes. * @param {Function} callback Function called when there are additions * or removals from the target's list of flattened nodes. */ @@ -113,6 +113,10 @@ */ this._nativeChildrenObserver = null; this._connected = false; + /** + * @type {Element} + * @private + */ this._target = target; this.callback = callback; this._effectiveNodes = []; @@ -181,6 +185,10 @@ this._connected = false; } + /** + * @return {void} + * @private + */ _schedule() { if (!this._scheduled) { this._scheduled = true; @@ -188,11 +196,21 @@ } } + /** + * @param {Array} mutations Mutations signaled by the mutation observer + * @return {void} + * @private + */ _processMutations(mutations) { this._processSlotMutations(mutations); this.flush(); } + /** + * @param {Array} mutations Mutations signaled by the mutation observer + * @return {void} + * @private + */ _processSlotMutations(mutations) { if (mutations) { for (let i=0; i < mutations.length; i++) { @@ -258,6 +276,11 @@ return didFlush; } + /** + * @param {!Array|!NodeList} nodeList Nodes that could change + * @return {void} + * @private + */ _listenSlots(nodeList) { for (let i=0; i < nodeList.length; i++) { let n = nodeList[i]; @@ -267,6 +290,11 @@ } } + /** + * @param {!Array|!NodeList} nodeList Nodes that could change + * @return {void} + * @private + */ _unlistenSlots(nodeList) { for (let i=0; i < nodeList.length; i++) { let n = nodeList[i]; diff --git a/lib/utils/gestures.html b/lib/utils/gestures.html index 29353f835d..3fbba8a5fa 100644 --- a/lib/utils/gestures.html +++ b/lib/utils/gestures.html @@ -80,21 +80,21 @@ let IS_TOUCH_ONLY = navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/); let GestureRecognizer = function(){}; // eslint-disable-line no-unused-vars - /** @type {function()} */ + /** @type {function(): void} */ GestureRecognizer.prototype.reset; - /** @type {function(MouseEvent) | undefined} */ + /** @type {function(MouseEvent): void | undefined} */ GestureRecognizer.prototype.mousedown; - /** @type {(function(MouseEvent) | undefined)} */ + /** @type {(function(MouseEvent): void | undefined)} */ GestureRecognizer.prototype.mousemove; - /** @type {(function(MouseEvent) | undefined)} */ + /** @type {(function(MouseEvent): void | undefined)} */ GestureRecognizer.prototype.mouseup; - /** @type {(function(TouchEvent) | undefined)} */ + /** @type {(function(TouchEvent): void | undefined)} */ GestureRecognizer.prototype.touchstart; - /** @type {(function(TouchEvent) | undefined)} */ + /** @type {(function(TouchEvent): void | undefined)} */ GestureRecognizer.prototype.touchmove; - /** @type {(function(TouchEvent) | undefined)} */ + /** @type {(function(TouchEvent): void | undefined)} */ GestureRecognizer.prototype.touchend; - /** @type {(function(MouseEvent) | undefined)} */ + /** @type {(function(MouseEvent): void | undefined)} */ GestureRecognizer.prototype.click; // touch will make synthetic mouse events diff --git a/lib/utils/templatize.html b/lib/utils/templatize.html index 28810322f1..4f3b043721 100644 --- a/lib/utils/templatize.html +++ b/lib/utils/templatize.html @@ -123,8 +123,14 @@ this.__dataHost._enqueueClient(this); } } + /** - * @override + * Override point for adding custom or simulated event handling. + * + * @param {!Node} node Node to add event listener to + * @param {string} eventName Name of event + * @param {Function} handler Listener function to add + * @return {void} */ _addEventListenerToNode(node, eventName, handler) { if (this._methodHost && this.__templatizeOptions.parentModel) { @@ -185,7 +191,11 @@ * textContent bindings while children are "hidden" and cache in * private storage for later retrieval. * - * @override + * @param {Node} node The node to set a property on + * @param {string} prop The property to set + * @param {*} value The value to set + * @return {void} + * @protected */ _setUnmanagedPropertyToNode(node, prop, value) { if (node.__hideTemplateChildren__ && diff --git a/types/extra-types.d.ts b/types/extra-types.d.ts index 60e147183d..36667de3aa 100644 --- a/types/extra-types.d.ts +++ b/types/extra-types.d.ts @@ -124,7 +124,7 @@ interface Binding { interface AsyncInterface { run: (fn: Function, delay?: number) => number; - cancel: (handle: number) => any; + cancel: (handle: number) => void; } /** @@ -138,14 +138,14 @@ type AsyncModule = AsyncInterface; */ interface GestureRecognizer { - reset: () => any; - mousedown?: (e: MouseEvent) => any; - mousemove?: (e: MouseEvent) => any; - mouseup?: (e: MouseEvent) => any; - touchstart?: (e: TouchEvent) => any; - touchmove?: (e: TouchEvent) => any; - touchend?: (e: TouchEvent) => any; - click?: (e: MouseEvent) => any; + reset: () => void; + mousedown?: (e: MouseEvent) => void; + mousemove?: (e: MouseEvent) => void; + mouseup?: (e: MouseEvent) => void; + touchstart?: (e: TouchEvent) => void; + touchmove?: (e: TouchEvent) => void; + touchend?: (e: TouchEvent) => void; + click?: (e: MouseEvent) => void; } /** diff --git a/types/lib/elements/dom-if.d.ts b/types/lib/elements/dom-if.d.ts index 7507dbee39..53348545d9 100644 --- a/types/lib/elements/dom-if.d.ts +++ b/types/lib/elements/dom-if.d.ts @@ -45,8 +45,8 @@ declare namespace Polymer { * in better performance. */ restamp: boolean|null|undefined; - connectedCallback(): any; - disconnectedCallback(): any; + connectedCallback(): void; + disconnectedCallback(): void; /** * Forces the element to render its content. Normally rendering is @@ -56,7 +56,13 @@ declare namespace Polymer { * validate application state. */ render(): void; - _showHideChildren(): any; + + /** + * Shows or hides the template instance top level child elements. For + * text nodes, `textContent` is removed while "hidden" and replaced when + * "shown." + */ + _showHideChildren(): void; } } diff --git a/types/lib/elements/dom-repeat.d.ts b/types/lib/elements/dom-repeat.d.ts index 723c074c3c..4bf9b4d69b 100644 --- a/types/lib/elements/dom-repeat.d.ts +++ b/types/lib/elements/dom-repeat.d.ts @@ -201,8 +201,8 @@ declare namespace Polymer { */ targetFramerate: number|null|undefined; _targetFrameTime: number|null|undefined; - disconnectedCallback(): any; - connectedCallback(): any; + disconnectedCallback(): void; + connectedCallback(): void; /** * Forces the element to render its content. Normally rendering is @@ -214,9 +214,14 @@ declare namespace Polymer { render(): void; /** - * Implements extension point from Templatize mixin + * Shows or hides the template instance top level child elements. For + * text nodes, `textContent` is removed while "hidden" and replaced when + * "shown." + * + * @param hidden Set to true to hide the children; + * set to false to show them. */ - _showHideChildren(hidden: any): any; + _showHideChildren(hidden: boolean): void; /** * Returns the item associated with a given element stamped by diff --git a/types/lib/legacy/class.d.ts b/types/lib/legacy/class.d.ts index 832e025dce..2068f0c42b 100644 --- a/types/lib/legacy/class.d.ts +++ b/types/lib/legacy/class.d.ts @@ -95,16 +95,21 @@ declare namespace Polymer { } declare class PolymerGenerated { - created(): any; - _registered(): any; - _applyListeners(): any; + created(): void; + _registered(): void; + _applyListeners(): void; + _ensureAttributes(): void; + ready(): void; + attached(): void; + detached(): void; /** - * only apply if not already set. + * Implements native Custom Elements `attributeChangedCallback` to + * set an attribute value to a property via `_attributeToProperty`. + * + * @param name Name of attribute that changed + * @param old Old attribute value + * @param value New attribute value */ - _ensureAttributes(): any; - ready(): any; - attached(): any; - detached(): any; - attributeChanged(name: any, old: any, value: any): any; + attributeChanged(name: string, old: string|null, value: string|null): void; } diff --git a/types/lib/legacy/legacy-element-mixin.d.ts b/types/lib/legacy/legacy-element-mixin.d.ts index 70c69e317f..40ce35b64b 100644 --- a/types/lib/legacy/legacy-element-mixin.d.ts +++ b/types/lib/legacy/legacy-element-mixin.d.ts @@ -37,14 +37,14 @@ declare namespace Polymer { * Overrides the default `Polymer.PropertyEffects` implementation to * add support for installing `hostAttributes` and `listeners`. */ - ready(): any; + ready(): void; /** * Overrides the default `Polymer.PropertyEffects` implementation to * add support for class initialization via the `_registered` callback. * This is called only when the first instance of the element is created. */ - _initializeProperties(): any; + _initializeProperties(): void; /** * Provides an override implementation of `attributeChangedCallback` @@ -60,31 +60,31 @@ declare namespace Polymer { * Provides an implementation of `connectedCallback` * which adds Polymer legacy API's `attached` method. */ - connectedCallback(): any; + connectedCallback(): void; /** * Provides an implementation of `disconnectedCallback` * which adds Polymer legacy API's `detached` method. */ - disconnectedCallback(): any; + disconnectedCallback(): void; /** * Legacy callback called during the `constructor`, for overriding * by the user. */ - created(): any; + created(): void; /** * Legacy callback called during `connectedCallback`, for overriding * by the user. */ - attached(): any; + attached(): void; /** * Legacy callback called during `disconnectedCallback`, for overriding * by the user. */ - detached(): any; + detached(): void; /** * Legacy callback called during `attributeChangedChallback`, for overriding @@ -94,7 +94,7 @@ declare namespace Polymer { * @param old Old value of attribute. * @param value Current value of attribute. */ - attributeChanged(name: string, old: string|null, value: string|null): any; + attributeChanged(name: string, old: string|null, value: string|null): void; /** * Called automatically when an element is initializing. @@ -102,7 +102,7 @@ declare namespace Polymer { * work. The implementation should ensure the work is performed * only once for the class. */ - _registered(): any; + _registered(): void; /** * Ensures an element has required attributes. Called when the element @@ -113,7 +113,7 @@ declare namespace Polymer { * to the element user and not done here; reasonable exceptions include * setting aria roles and focusability. */ - _ensureAttributes(): any; + _ensureAttributes(): void; /** * Adds element event listeners. Called when the element @@ -124,7 +124,7 @@ declare namespace Polymer { * these elements, consider adding listeners asynchronously so as not to * block render. */ - _applyListeners(): any; + _applyListeners(): void; /** * Converts a typed JavaScript value to a string. @@ -398,9 +398,13 @@ declare namespace Polymer { isLocalDescendant(node?: Element|null): boolean; /** - * NOTE: should now be handled by ShadyCss library. + * No-op for backwards compatibility. This should now be handled by + * ShadyCss library. + * + * @param container Unused + * @param shouldObserve Unused */ - scopeSubtree(container: any, shouldObserve: any): any; + scopeSubtree(container: any, shouldObserve: any): void; /** * Returns the computed style value for the given property. @@ -528,7 +532,7 @@ declare namespace Polymer { * When unspecified, the state of the attribute will be reversed. * @param node Node to target. Defaults to `this`. */ - toggleAttribute(name: string, bool?: boolean, node?: Element|null): any; + toggleAttribute(name: string, bool?: boolean, node?: Element|null): void; /** * Toggles a CSS class on or off. @@ -538,7 +542,7 @@ declare namespace Polymer { * When unspecified, the state of the class will be reversed. * @param node Node to target. Defaults to `this`. */ - toggleClass(name: string, bool?: boolean, node?: Element|null): any; + toggleClass(name: string, bool?: boolean, node?: Element|null): void; /** * Cross-platform helper for setting an element's CSS `transform` property. @@ -584,28 +588,28 @@ declare namespace Polymer { * @param level One of 'log', 'warn', 'error' * @param args Array of strings or objects to log */ - _logger(level: string, args: any[]|null): any; + _logger(level: string, args: any[]|null): void; /** * Facades `console.log` as an override point. * * @param args Array of strings or objects to log */ - _log(...args: any[]): any; + _log(...args: any[]): void; /** * Facades `console.warn` as an override point. * * @param args Array of strings or objects to log */ - _warn(...args: any[]): any; + _warn(...args: any[]): void; /** * Facades `console.error` as an override point. * * @param args Array of strings or objects to log */ - _error(...args: any[]): any; + _error(...args: any[]): void; /** * Formats a message using the element type an a method name. diff --git a/types/lib/mixins/dir-mixin.d.ts b/types/lib/mixins/dir-mixin.d.ts index 979a9cf1a9..066869c8fe 100644 --- a/types/lib/mixins/dir-mixin.d.ts +++ b/types/lib/mixins/dir-mixin.d.ts @@ -33,8 +33,8 @@ declare namespace Polymer { } & T interface DirMixin { - ready(): any; - connectedCallback(): any; - disconnectedCallback(): any; + ready(): void; + connectedCallback(): void; + disconnectedCallback(): void; } } diff --git a/types/lib/mixins/element-mixin.d.ts b/types/lib/mixins/element-mixin.d.ts index d6e4bb76ee..fe711889c4 100644 --- a/types/lib/mixins/element-mixin.d.ts +++ b/types/lib/mixins/element-mixin.d.ts @@ -90,7 +90,7 @@ declare namespace Polymer { /** * Stamps the element template. */ - ready(): any; + ready(): void; /** * Overrides the default `Polymer.PropertyAccessors` to ensure class @@ -100,7 +100,7 @@ declare namespace Polymer { * It also initializes any property defaults provided via `value` in * `properties` metadata. */ - _initializeProperties(): any; + _initializeProperties(): void; /** * Implements `PropertyEffects`'s `_readyClients` call. Attaches @@ -109,7 +109,7 @@ declare namespace Polymer { * client dom to be attached to the element prior to any observers * running. */ - _readyClients(): any; + _readyClients(): void; /** * Provides a default implementation of the standard Custom Elements @@ -119,7 +119,7 @@ declare namespace Polymer { * flushes any pending properties, and updates shimmed CSS properties * when using the ShadyCSS scoping/custom properties polyfill. */ - connectedCallback(): any; + connectedCallback(): void; /** * Attaches an element's stamped dom to itself. By default, diff --git a/types/lib/mixins/gesture-event-listeners.d.ts b/types/lib/mixins/gesture-event-listeners.d.ts index c954cc8dd2..7d632f59b0 100644 --- a/types/lib/mixins/gesture-event-listeners.d.ts +++ b/types/lib/mixins/gesture-event-listeners.d.ts @@ -28,7 +28,23 @@ declare namespace Polymer { } & T interface GestureEventListeners { - _addEventListenerToNode(node: any, eventName: any, handler: any): any; - _removeEventListenerFromNode(node: any, eventName: any, handler: any): any; + + /** + * Add the event listener to the node if it is a gestures event. + * + * @param node Node to add event listener to + * @param eventName Name of event + * @param handler Listener function to add + */ + _addEventListenerToNode(node: Node, eventName: string, handler: Function): void; + + /** + * Remove the event listener to the node if it is a gestures event. + * + * @param node Node to remove event listener from + * @param eventName Name of event + * @param handler Listener function to remove + */ + _removeEventListenerFromNode(node: Node, eventName: string, handler: Function): void; } } diff --git a/types/lib/mixins/properties-changed.d.ts b/types/lib/mixins/properties-changed.d.ts index 4dabca1f14..22bf9ffceb 100644 --- a/types/lib/mixins/properties-changed.d.ts +++ b/types/lib/mixins/properties-changed.d.ts @@ -50,7 +50,7 @@ declare namespace Polymer { * @param readOnly When true, no setter is created; the * protected `_setProperty` function must be used to set the property */ - _createPropertyAccessor(property: string, readOnly?: boolean): any; + _createPropertyAccessor(property: string, readOnly?: boolean): void; /** * Defines a property accessor for the given property. @@ -58,7 +58,7 @@ declare namespace Polymer { * @param property Name of the property * @param readOnly When true, no setter is created */ - _definePropertyAccessor(property: string, readOnly?: boolean): any; + _definePropertyAccessor(property: string, readOnly?: boolean): void; /** * Lifecycle callback called when properties are enabled via @@ -71,7 +71,7 @@ declare namespace Polymer { * bindings. `super.ready()` must be called to ensure the data system * becomes enabled. */ - ready(): any; + ready(): void; /** * Initializes the local storage for property accessors. @@ -79,7 +79,7 @@ declare namespace Polymer { * Provided as an override point for performing any setup work prior * to initializing the property accessor system. */ - _initializeProperties(): any; + _initializeProperties(): void; /** * Called at ready time with bag of instance properties that overwrote @@ -92,7 +92,7 @@ declare namespace Polymer { * @param props Bag of property values that were overwritten * when creating property accessors. */ - _initializeInstanceProperties(props: object|null): any; + _initializeInstanceProperties(props: object|null): void; /** * Updates the local storage for a property (via `_setPendingProperty`) @@ -101,7 +101,7 @@ declare namespace Polymer { * @param property Name of the property * @param value Value to set */ - _setProperty(property: string, value: any): any; + _setProperty(property: string, value: any): void; /** * Returns the value for the given property. @@ -128,7 +128,7 @@ declare namespace Polymer { * Marks the properties as invalid, and enqueues an async * `_propertiesChanged` callback. */ - _invalidateProperties(): any; + _invalidateProperties(): void; /** * Call to enable property accessor processing. Before this method is @@ -138,7 +138,7 @@ declare namespace Polymer { * It is safe to call this method multiple times as it only turns on * property accessors once. */ - _enableProperties(): any; + _enableProperties(): void; /** * Calls the `_propertiesChanged` callback with the current set of @@ -146,7 +146,7 @@ declare namespace Polymer { * set), and resets the pending set of changes. Generally, this method * should not be called in user code. */ - _flushProperties(): any; + _flushProperties(): void; /** * Callback called when any properties with accessors created via @@ -158,7 +158,7 @@ declare namespace Polymer { * @param oldProps Bag of previous values for each property * in `changedProps` */ - _propertiesChanged(currentProps: object, changedProps: object, oldProps: object): any; + _propertiesChanged(currentProps: object, changedProps: object, oldProps: object): void; /** * Method called to determine whether a property value should be @@ -188,7 +188,7 @@ declare namespace Polymer { * @param old Old attribute value * @param value New attribute value */ - attributeChangedCallback(name: string, old: string|null, value: string|null): any; + attributeChangedCallback(name: string, old: string|null, value: string|null): void; /** * Deserializes an attribute to its associated property. @@ -201,7 +201,7 @@ declare namespace Polymer { * @param type type to deserialize to, defaults to the value * returned from `typeForProperty` */ - _attributeToProperty(attribute: string, value: string|null, type?: any): any; + _attributeToProperty(attribute: string, value: string|null, type?: any): void; /** * Serializes a property to its associated attribute. @@ -210,7 +210,7 @@ declare namespace Polymer { * @param attribute Attribute name to reflect to. * @param value Property value to refect. */ - _propertyToAttribute(property: string, attribute?: string, value?: any): any; + _propertyToAttribute(property: string, attribute?: string, value?: any): void; /** * Sets a typed value to an HTML attribute on a node. @@ -224,7 +224,7 @@ declare namespace Polymer { * @param value Value to serialize. * @param attribute Attribute name to serialize to. */ - _valueToNodeAttribute(node: Element|null, value: any, attribute: string): any; + _valueToNodeAttribute(node: Element|null, value: any, attribute: string): void; /** * Converts a typed JavaScript value to a string. diff --git a/types/lib/mixins/properties-mixin.d.ts b/types/lib/mixins/properties-mixin.d.ts index d31e89cd3b..2149fa599f 100644 --- a/types/lib/mixins/properties-mixin.d.ts +++ b/types/lib/mixins/properties-mixin.d.ts @@ -35,18 +35,18 @@ declare namespace Polymer { * Overrides `PropertiesChanged` method and adds a call to * `finalize` which lazily configures the element's property accessors. */ - _initializeProperties(): any; + _initializeProperties(): void; /** * Called when the element is added to a document. * Calls `_enableProperties` to turn on property system from * `PropertiesChanged`. */ - connectedCallback(): any; + connectedCallback(): void; /** * Called when the element is removed from a document */ - disconnectedCallback(): any; + disconnectedCallback(): void; } } diff --git a/types/lib/mixins/property-effects.d.ts b/types/lib/mixins/property-effects.d.ts index 191ae6fb5d..1825a1254e 100644 --- a/types/lib/mixins/property-effects.d.ts +++ b/types/lib/mixins/property-effects.d.ts @@ -77,8 +77,8 @@ declare namespace Polymer { * Also calls `_flushClients` callback to ensure client dom is enabled * that was not enabled as a result of flushing properties. */ - ready(): any; - _initializeProperties(): any; + ready(): void; + _initializeProperties(): void; /** * Overrides `Polymer.PropertyAccessors` implementation to avoid setting @@ -86,13 +86,16 @@ declare namespace Polymer { * * @param props Properties to initialize on the instance */ - _initializeInstanceProperties(props: object|null): any; + _initializeInstanceProperties(props: object|null): void; /** * Overrides base implementation to ensure all accessors set `shouldNotify` * to true, for per-property notification tracking. + * + * @param property Name of the property + * @param value Value to set */ - _setProperty(property: any, value: any): any; + _setProperty(property: string, value: any): void; /** * Overrides the `PropertiesChanged` implementation to introduce special @@ -136,20 +139,26 @@ declare namespace Polymer { * manually flushed), the function no-ops; otherwise flushes * `_propertiesChanged` synchronously. */ - _invalidateProperties(): any; + _invalidateProperties(): void; /** * Overrides superclass implementation. */ - _flushProperties(): any; + _flushProperties(): void; /** * Implements `PropertyAccessors`'s properties changed callback. * * Runs each class of effects for the batch of changed properties in * a specific order (compute, propagate, reflect, observe, notify). + * + * @param currentProps Bag of all current accessor values + * @param changedProps Bag of properties changed since the last + * call to `_propertiesChanged` + * @param oldProps Bag of previous values for each property + * in `changedProps` */ - _propertiesChanged(currentProps: any, changedProps: any, oldProps: any): any; + _propertiesChanged(currentProps: object, changedProps: object, oldProps: object): void; /** * Overrides `Polymer.PropertyAccessors` implementation to provide a @@ -158,7 +167,7 @@ declare namespace Polymer { * * @param props Properties to initialize on the prototype */ - _initializeProtoProperties(props: object|null): any; + _initializeProtoProperties(props: object|null): void; /** * Equivalent to static `addPropertyEffect` API but can be called on diff --git a/types/lib/mixins/template-stamp.d.ts b/types/lib/mixins/template-stamp.d.ts index bfbaa9af16..c417ea9a88 100644 --- a/types/lib/mixins/template-stamp.d.ts +++ b/types/lib/mixins/template-stamp.d.ts @@ -65,7 +65,7 @@ declare namespace Polymer { * to `node`) * @returns Generated handler function */ - _addMethodEventListenerToNode(node: Node|null, eventName: string, methodName: string, context?: any): Function|null; + _addMethodEventListenerToNode(node: Node, eventName: string, methodName: string, context?: any): Function; /** * Override point for adding custom or simulated event handling. @@ -74,7 +74,7 @@ declare namespace Polymer { * @param eventName Name of event * @param handler Listener function to add */ - _addEventListenerToNode(node: Node|null, eventName: string, handler: Function|null): void; + _addEventListenerToNode(node: Node, eventName: string, handler: Function): void; /** * Override point for adding custom or simulated event handling. diff --git a/types/lib/utils/flattened-nodes-observer.d.ts b/types/lib/utils/flattened-nodes-observer.d.ts index e6f5d2ed25..556ef57167 100644 --- a/types/lib/utils/flattened-nodes-observer.d.ts +++ b/types/lib/utils/flattened-nodes-observer.d.ts @@ -68,9 +68,6 @@ declare namespace Polymer { * the observer. */ disconnect(): void; - _schedule(): any; - _processMutations(mutations: any): any; - _processSlotMutations(mutations: any): any; /** * Flushes the observer causing any pending changes to be immediately @@ -81,7 +78,5 @@ declare namespace Polymer { * callback to run. */ flush(): boolean; - _listenSlots(nodeList: any): any; - _unlistenSlots(nodeList: any): any; } } diff --git a/types/lib/utils/templatize.d.ts b/types/lib/utils/templatize.d.ts index dc866ad9cf..b08485e824 100644 --- a/types/lib/utils/templatize.d.ts +++ b/types/lib/utils/templatize.d.ts @@ -15,14 +15,26 @@ declare class TemplateInstanceBase extends Polymer.PropertyEffects( Polymer.Element) { - _addEventListenerToNode(node: any, eventName: any, handler: any): any; + + /** + * Override point for adding custom or simulated event handling. + * + * @param node Node to add event listener to + * @param eventName Name of event + * @param handler Listener function to add + */ + _addEventListenerToNode(node: Node, eventName: string, handler: Function): void; /** * Overrides default property-effects implementation to intercept * textContent bindings while children are "hidden" and cache in * private storage for later retrieval. + * + * @param node The node to set a property on + * @param prop The property to set + * @param value The value to set */ - _setUnmanagedPropertyToNode(node: any, prop: any, value: any): any; + _setUnmanagedPropertyToNode(node: Node|null, prop: string, value: any): void; /** * Forwards a host property to this instance. This method should be