diff --git a/lib/legacy/class.html b/lib/legacy/class.html index afe838cc57..82349b620b 100644 --- a/lib/legacy/class.html +++ b/lib/legacy/class.html @@ -353,17 +353,21 @@ * * @param {!PolymerInit} info Object containing Polymer metadata and functions * to become class methods. + * @template T + * @param {function(T):T} mixin Optional mixin to apply to legacy base class * @return {function(new:HTMLElement)} Generated class * @memberof Polymer */ - Polymer.Class = function(info) { + Polymer.Class = function(info, mixin) { if (!info) { console.warn('Polymer.Class requires `info` argument'); } - let klass = GenerateClassFromInfo(info, info.behaviors ? + const baseWithBehaviors = info.behaviors ? // note: mixinBehaviors ensures `LegacyElementMixin`. mixinBehaviors(info.behaviors, HTMLElement) : - Polymer.LegacyElementMixin(HTMLElement)); + Polymer.LegacyElementMixin(HTMLElement); + const baseWithMixin = mixin ? mixin(baseWithBehaviors) : baseWithBehaviors; + const klass = GenerateClassFromInfo(info, baseWithMixin); // decorate klass with registration info klass.is = info.is; return klass; diff --git a/lib/legacy/legacy-data-mixin.html b/lib/legacy/legacy-data-mixin.html new file mode 100644 index 0000000000..32ad88c941 --- /dev/null +++ b/lib/legacy/legacy-data-mixin.html @@ -0,0 +1,104 @@ + + + + + diff --git a/lib/mixins/property-effects.html b/lib/mixins/property-effects.html index de92b17c4a..8cb808d6fa 100644 --- a/lib/mixins/property-effects.html +++ b/lib/mixins/property-effects.html @@ -814,7 +814,7 @@ let context = inst._methodHost || inst; let fn = context[info.methodName]; if (fn) { - let args = marshalArgs(inst.__data, info.args, property, props); + let args = inst._marshalArgs(info.args, property, props); return fn.apply(context, args); } else if (!info.dynamicFn) { console.warn('method `' + info.methodName + '` not defined'); @@ -970,56 +970,6 @@ return a; } - /** - * Gather the argument values for a method specified in the provided array - * of argument metadata. - * - * The `path` and `value` arguments are used to fill in wildcard descriptor - * when the method is being called as a result of a path notification. - * - * @param {Object} data Instance data storage object to read properties from - * @param {!Array} args Array of argument metadata - * @param {string} path Property/path name that triggered the method effect - * @param {Object} props Bag of current property changes - * @return {Array<*>} Array of argument values - * @private - */ - function marshalArgs(data, args, path, props) { - let values = []; - for (let i=0, l=args.length; i} args Array of argument metadata + * @param {string} path Property/path name that triggered the method effect + * @param {Object} props Bag of current property changes + * @return {Array<*>} Array of argument values + * @private + */ + _marshalArgs(args, path, props) { + const data = this.__data; + let values = []; + for (let i=0, l=args.length; i + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +