Skip to content

Commit b12a0b6

Browse files
author
Steven Orvell
committed
Minor renaming based on review.
1 parent 9e14172 commit b12a0b6

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

lib/legacy/class.html

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@
2424
attributeChanged: true,
2525
};
2626

27-
const noCopyProps = Object.assign({
27+
const excludeProps = Object.assign({
2828
behaviors: true
2929
}, metaProps);
3030

31-
const filteredProps = Object.assign({
31+
const lifecycleProps = Object.assign({
3232
listeners: true,
3333
hostAttributes: true
3434
}, metaProps);
3535

3636
function copyProperties(source, target) {
3737
for (let p in source) {
38-
// NOTE: cannot copy `noCopyProps` methods onto prototype at least because
38+
// NOTE: cannot copy `excludeProps` methods onto prototype at least because
3939
// `super.ready` must be called and is not included in the user fn.
40-
if (!(p in noCopyProps)) {
40+
if (!(p in excludeProps)) {
4141
let pd = Object.getOwnPropertyDescriptor(source, p);
4242
if (pd) {
4343
Object.defineProperty(target, p, pd);
@@ -95,18 +95,18 @@
9595
// If lifecycle is called (super then me), order is
9696
// (1) C.created, (2) A.created, (3) B.created, (4) element.created
9797
// (again same as 1.x)
98-
function copyAndFilterBehaviors(proto, behaviors, lifecycle) {
98+
function applyBehaviors(proto, behaviors, lifecycle) {
9999
for (let i=0; i<behaviors.length; i++) {
100-
copyAndFilterProperties(proto, behaviors[i], lifecycle);
100+
applyInfo(proto, behaviors[i], lifecycle);
101101
}
102102
}
103103

104-
function copyAndFilterProperties(proto, infoOrBehavior, lifecycle) {
105-
copyProperties(infoOrBehavior, proto);
106-
for (let p in filteredProps) {
107-
if (infoOrBehavior[p]) {
104+
function applyInfo(proto, info, lifecycle) {
105+
copyProperties(info, proto);
106+
for (let p in lifecycleProps) {
107+
if (info[p]) {
108108
lifecycle[p] = lifecycle[p] || [];
109-
lifecycle[p].push(infoOrBehavior[p]);
109+
lifecycle[p].push(info[p]);
110110
}
111111
}
112112
}
@@ -219,17 +219,17 @@
219219
function GenerateClassFromInfo(info, Base, behaviors) {
220220

221221
// manages behavior and lifecycle processing (filled in after class definition)
222-
let activeBehaviors;
222+
let behaviorList;
223223
const lifecycle = {};
224224

225225
/** @private */
226226
class PolymerGenerated extends Base {
227227

228228
static get properties() {
229229
const properties = {};
230-
if (activeBehaviors) {
231-
for (let i=0, b; i < activeBehaviors.length; i++) {
232-
b = activeBehaviors[i];
230+
if (behaviorList) {
231+
for (let i=0, b; i < behaviorList.length; i++) {
232+
b = behaviorList[i];
233233
mergeElementProperties(properties, b.properties);
234234
}
235235
}
@@ -239,9 +239,9 @@
239239

240240
static get observers() {
241241
let observers = [];
242-
if (activeBehaviors) {
243-
for (let i=0, b; i < activeBehaviors.length; i++) {
244-
b = activeBehaviors[i];
242+
if (behaviorList) {
243+
for (let i=0, b; i < behaviorList.length; i++) {
244+
b = behaviorList[i];
245245
if (b.observers) {
246246
observers = observers.concat(b.observers);
247247
}
@@ -279,10 +279,10 @@
279279
`is` in `beforeRegister` as you could in 1.x.
280280
*/
281281
const proto = this;
282-
if (activeBehaviors) {
283-
copyAndFilterBehaviors(proto, activeBehaviors, lifecycle);
282+
if (behaviorList) {
283+
applyBehaviors(proto, behaviorList, lifecycle);
284284
}
285-
copyAndFilterProperties(proto, info, lifecycle);
285+
applyInfo(proto, info, lifecycle);
286286
let list = lifecycle.beforeRegister;
287287
if (list) {
288288
for (let i=0; i < list.length; i++) {
@@ -403,9 +403,9 @@
403403
}
404404
let superBehaviors = Base.prototype.behaviors;
405405
// get flattened, deduped list of behaviors *not* already on super class
406-
activeBehaviors = flattenBehaviors(behaviors, null, superBehaviors);
406+
behaviorList = flattenBehaviors(behaviors, null, superBehaviors);
407407
PolymerGenerated.prototype.behaviors = superBehaviors ?
408-
superBehaviors.concat(behaviors) : activeBehaviors;
408+
superBehaviors.concat(behaviors) : behaviorList;
409409
}
410410

411411
PolymerGenerated.generatedFrom = info;

0 commit comments

Comments
 (0)