OLD | NEW |
| (Empty) |
1 Polymer.mixin2 = function(prototype, mixin) { | |
2 | |
3 // adds a single mixin to prototype | |
4 | |
5 if (mixin.mixinPublish) { | |
6 prototype.publish = prototype.publish || {}; | |
7 Polymer.mixin(prototype.publish, mixin.mixinPublish); | |
8 } | |
9 | |
10 if (mixin.mixinDelegates) { | |
11 prototype.eventDelegates = prototype.eventDelegates || {}; | |
12 for (var e in mixin.mixinDelegates) { | |
13 if (!prototype.eventDelegates[e]) { | |
14 prototype.eventDelegates[e] = mixin.mixinDelegates[e]; | |
15 } | |
16 } | |
17 } | |
18 | |
19 if (mixin.mixinObserve) { | |
20 prototype.observe = prototype.observe || {}; | |
21 for (var o in mixin.mixinObserve) { | |
22 if (!prototype.observe[o] && !prototype[o + 'Changed']) { | |
23 prototype.observe[o] = mixin.mixinObserve[o]; | |
24 } | |
25 } | |
26 } | |
27 | |
28 Polymer.mixin(prototype, mixin); | |
29 | |
30 delete prototype.mixinPublish; | |
31 delete prototype.mixinDelegates; | |
32 delete prototype.mixinObserve; | |
33 | |
34 return prototype; | |
35 }; | |
OLD | NEW |