mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
144 lines
2.2 KiB
HTML
144 lines
2.2 KiB
HTML
<!--
|
|
@license
|
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
Code distributed by Google as part of the polymer project is also
|
|
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
-->
|
|
|
|
<script>
|
|
|
|
Polymer.BehaviorA = {
|
|
|
|
properties: {
|
|
|
|
label: {
|
|
type: String,
|
|
observer: '_labelChanged'
|
|
},
|
|
|
|
hasOptionsA: {
|
|
readOnly: true,
|
|
notify: true
|
|
},
|
|
|
|
overridableProperty: {
|
|
value: false
|
|
}
|
|
|
|
},
|
|
|
|
listeners: {
|
|
change: '_changeHandler'
|
|
},
|
|
|
|
ready: function() {
|
|
this.__readyA = true;
|
|
},
|
|
|
|
_labelChanged: function(label) {
|
|
this.__label = label;
|
|
},
|
|
|
|
_changeHandler: function(e) {
|
|
this.__change = e.detail.value;
|
|
},
|
|
|
|
_toOverride: function() {
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<script>
|
|
|
|
Polymer.BehaviorB = {
|
|
|
|
properties: {
|
|
|
|
disabled: {
|
|
type: Boolean,
|
|
value: false,
|
|
observer: '_disabledChanged'
|
|
},
|
|
|
|
hasOptionsB: {
|
|
readOnly: true,
|
|
notify: true
|
|
}
|
|
|
|
},
|
|
|
|
_disabledChanged: function(disabled) {
|
|
this.__disabled = disabled
|
|
},
|
|
|
|
ready: function() {
|
|
this.__readyB = true;
|
|
},
|
|
|
|
_toOverride: function() {}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<dom-module id="single-behavior">
|
|
|
|
<script>
|
|
|
|
Polymer({
|
|
|
|
behaviors: [
|
|
Polymer.BehaviorA
|
|
]
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</dom-module>
|
|
|
|
<dom-module id="multi-behaviors">
|
|
|
|
<script>
|
|
|
|
Polymer._toOverride = function() {};
|
|
|
|
Polymer({
|
|
|
|
behaviors: [
|
|
Polymer.BehaviorA,
|
|
Polymer.BehaviorB
|
|
],
|
|
|
|
properties: {
|
|
|
|
foo: {
|
|
type: String,
|
|
reflectToAttribute: true,
|
|
readOnly: true,
|
|
observer: '_fooChanged'
|
|
},
|
|
|
|
overridableProperty: {
|
|
value: true
|
|
}
|
|
|
|
},
|
|
|
|
_fooChanged: function(foo) {
|
|
this.__foo = foo;
|
|
},
|
|
|
|
_toOverride: Polymer._toOverride
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</dom-module>
|