Allow Polymer fn's call to Class to be overridden.

This commit is contained in:
Kevin Schaaf
2018-04-19 16:26:04 -07:00
parent 180a92ff28
commit 65d73f17c7

View File

@@ -28,15 +28,19 @@ import '../utils/boot.js';
* @return {function(new: HTMLElement)} Generated class
* @suppress {duplicate, invalidCasts, checkTypes}
*/
export const Polymer = function(info) {
const Polymer = function(info) {
// if input is a `class` (aka a function with a prototype), use the prototype
// remember that the `constructor` will never be called
let klass;
if (typeof info === 'function') {
klass = info;
} else {
klass = Class(info);
klass = Polymer.Class(info);
}
customElements.define(klass.is, /** @type {!HTMLElement} */(klass));
return klass;
};
Polymer.Class = Class;
export { Polymer };