save observedAttributes for registration calls

This commit is contained in:
Daniel Freedman
2017-01-13 13:01:18 -08:00
parent a50a8c09d2
commit 80d3fca5fb
3 changed files with 46 additions and 30 deletions

View File

@@ -1,16 +1,51 @@
window.Polymer = {};
/**
* @fileoverview Externs for Polymer, polyfills, and missing stuff in Closure Compiler
* @externs
* */
/**
* @param {!{is: string}} init
*/
function Polymer(init){}
function Polymer(){}
/**
* @record
*/
function CustomElement(){}
/** @type {!Array<string> | undefined} */
CustomElement.observedAttributes;
/** @type {function()|undefined} */
CustomElement.prototype.connectedCallback;
/** @type {function()|undefined} */
CustomElement.prototype.disconnectedCallback;
/** @type {function(string, ?string, ?string, ?string)|undefined} */
CustomElement.prototype.attributeChangedCallback;
let customElements = {
define(){},
get(){},
whenDefined(){}
const customElements = {
/**
* @param {string} tagName
* @param {!CustomElement} klass
* @param {Object=} options
* @return {CustomElement}
*/
define(tagName, klass, options){},
/**
* @param {string} tagName
* @return {CustomElement}
*/
get(tagName){},
/**
* @param {string} tagName
* @return {Promise<!CustomElement>}
*/
whenDefined(tagName){}
}
window.customElements = customElements;
let HTMLImports = {
whenReady(){}
/**
* @param {function()} callback
*/
whenReady(callback){}
};
window.HTMLImports = HTMLImports;
@@ -64,24 +99,6 @@ function CustomStyle(){}
*/
CustomStyle.prototype.processHook = function(style){};
/**
* @record
*/
function CustomElement(){}
/**
* @type {!Array<string> | undefined}
*/
CustomElement.observedAttributes;
CustomElement.prototype.connectedCallback = function(){};
CustomElement.prototype.disconnectedCallback = function(){};
/**
* @param {string} attributeName
* @param {?string} oldValue
* @param {?string} newValue
* @param {?string} namespaceURI
*/
CustomElement.prototype.attributeChangedCallback = function(attributeName, oldValue, newValue, namespaceURI){};
/**
* @constructor
* @extends {HTMLElement}

View File

@@ -94,7 +94,8 @@ gulp.task('build', ['clean'], () => {
output_wrapper: '(function(){\n%output%\n}).call(self)',
rewrite_polyfills: false,
formatting: 'PRETTY_PRINT',
externs: ['externs/externs.js']
externs: 'externs/externs.js'
// polymer_pass: true
});
const closurePipeline = lazypipe()

View File

@@ -28,10 +28,6 @@
static get observedAttributes() { return ['id'] }
get modules() {
return modules;
}
attributeChangedCallback(name, old, value) {
if (old !== value) {
this.register();
@@ -86,6 +82,8 @@
}
DomModule.prototype['modules'] = modules;
customElements.define('dom-module', DomModule);
// export