Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of polymer; | 5 part of polymer; |
| 6 | 6 |
| 7 /// Use this annotation to publish a field as an attribute. For example: | 7 /// Use this annotation to publish a field as an attribute. For example: |
| 8 /// | 8 /// |
| 9 /// class MyPlaybackElement extends PolymerElement { | 9 /// class MyPlaybackElement extends PolymerElement { |
| 10 /// // This will be available as an HTML attribute, for example: | 10 /// // This will be available as an HTML attribute, for example: |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 619 return true; | 619 return true; |
| 620 } | 620 } |
| 621 | 621 |
| 622 void unregisterObservers() { | 622 void unregisterObservers() { |
| 623 if (_observers == null) return; | 623 if (_observers == null) return; |
| 624 for (var sub in _observers.values) sub.cancel(); | 624 for (var sub in _observers.values) sub.cancel(); |
| 625 _observers.clear(); | 625 _observers.clear(); |
| 626 _observers = null; | 626 _observers = null; |
| 627 } | 627 } |
| 628 | 628 |
| 629 /// Bind a [property] in this object to a [path] in model. *Note* in Dart it | 629 /// Bind the [name] property in this element to [bindable]. |
|
Siggi Cherem (dart-lang)
2014/05/07 17:24:39
this [path] was marking the import as 'used', so t
| |
| 630 /// is necessary to also define the field: | |
| 631 /// | |
| 632 /// var myProperty; | |
| 633 /// | |
| 634 /// ready() { | |
| 635 /// super.ready(); | |
| 636 /// bindProperty(#myProperty, this, 'myModel.path.to.otherProp'); | |
|
Jennifer Messerly
2014/05/07 19:28:53
I fixed this code snippet in my port without remov
Siggi Cherem (dart-lang)
2014/05/07 19:34:48
Done
| |
| 637 /// } | |
| 638 Bindable bindProperty(Symbol name, Bindable bindable) { | 630 Bindable bindProperty(Symbol name, Bindable bindable) { |
| 639 // Dart note: normally we only reach this code when we know it's a | 631 // Dart note: normally we only reach this code when we know it's a |
| 640 // property, but if someone uses bindProperty directly they might get a | 632 // property, but if someone uses bindProperty directly they might get a |
| 641 // NoSuchMethodError either from the getField below, or from the setField | 633 // NoSuchMethodError either from the getField below, or from the setField |
| 642 // inside PolymerBinding. That doesn't seem unreasonable, but it's a slight | 634 // inside PolymerBinding. That doesn't seem unreasonable, but it's a slight |
| 643 // difference from Polymer.js behavior. | 635 // difference from Polymer.js behavior. |
| 644 | 636 |
| 645 if (_bindLog.isLoggable(Level.FINE)) { | 637 if (_bindLog.isLoggable(Level.FINE)) { |
| 646 _bindLog.fine('bindProperty: [$bindable] to [${localName}].[name]'); | 638 _bindLog.fine('bindProperty: [$bindable] to [${localName}].[name]'); |
| 647 } | 639 } |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1020 if (_sub != null) { | 1012 if (_sub != null) { |
| 1021 if (_eventsLog.isLoggable(Level.FINE)) { | 1013 if (_eventsLog.isLoggable(Level.FINE)) { |
| 1022 _eventsLog.fine( | 1014 _eventsLog.fine( |
| 1023 'event.remove: [$_node].$_eventName => [$_model].$_path())'); | 1015 'event.remove: [$_node].$_eventName => [$_model].$_path())'); |
| 1024 } | 1016 } |
| 1025 _sub.cancel(); | 1017 _sub.cancel(); |
| 1026 _sub = null; | 1018 _sub = null; |
| 1027 } | 1019 } |
| 1028 } | 1020 } |
| 1029 } | 1021 } |
| OLD | NEW |