| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 _typesByName[name] = type; | 74 _typesByName[name] = type; |
| 75 | 75 |
| 76 // Dart note: here we notify JS of the element registration. We don't pass | 76 // Dart note: here we notify JS of the element registration. We don't pass |
| 77 // the Dart type because we will handle that in PolymerDeclaration. | 77 // the Dart type because we will handle that in PolymerDeclaration. |
| 78 // See _hookJsPolymerDeclaration for how this is done. | 78 // See _hookJsPolymerDeclaration for how this is done. |
| 79 (js.context['Polymer'] as JsFunction).apply([name]); | 79 (js.context['Polymer'] as JsFunction).apply([name]); |
| 80 } | 80 } |
| 81 | 81 |
| 82 /// The one syntax to rule them all. | 82 /// The one syntax to rule them all. |
| 83 static final BindingDelegate _polymerSyntax = | 83 static final BindingDelegate _polymerSyntax = |
| 84 new _PolymerExpressionsWithEventDelegate(); | 84 new PolymerExpressionsWithEvents(); |
| 85 | 85 |
| 86 static int _preparingElements = 0; | 86 static int _preparingElements = 0; |
| 87 | 87 |
| 88 static final Completer _ready = new Completer(); | 88 static final Completer _ready = new Completer(); |
| 89 | 89 |
| 90 /// Future indicating that the Polymer library has been loaded and is ready | 90 /// Future indicating that the Polymer library has been loaded and is ready |
| 91 /// for use. | 91 /// for use. |
| 92 static Future get onReady => _ready.future; | 92 static Future get onReady => _ready.future; |
| 93 | 93 |
| 94 PolymerDeclaration _declaration; | 94 PolymerDeclaration _declaration; |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 PolymerElement.created() : super.created() { | 961 PolymerElement.created() : super.created() { |
| 962 polymerCreated(); | 962 polymerCreated(); |
| 963 } | 963 } |
| 964 } | 964 } |
| 965 | 965 |
| 966 class _PropertyValue { | 966 class _PropertyValue { |
| 967 Object oldValue, newValue; | 967 Object oldValue, newValue; |
| 968 _PropertyValue(this.oldValue); | 968 _PropertyValue(this.oldValue); |
| 969 } | 969 } |
| 970 | 970 |
| 971 class _PolymerExpressionsWithEventDelegate extends PolymerExpressions { | 971 class PolymerExpressionsWithEvents extends PolymerExpressions { |
| 972 PolymerExpressionsWithEvents({Map<String, Object> globals}) |
| 973 : super(globals: globals); |
| 974 |
| 972 prepareBinding(String path, name, node) { | 975 prepareBinding(String path, name, node) { |
| 973 if (_hasEventPrefix(name)) return Polymer.prepareBinding(path, name, node); | 976 if (_hasEventPrefix(name)) return Polymer.prepareBinding(path, name, node); |
| 974 return super.prepareBinding(path, name, node); | 977 return super.prepareBinding(path, name, node); |
| 975 } | 978 } |
| 976 } | 979 } |
| 977 | 980 |
| 978 class _EventBindable extends Bindable { | 981 class _EventBindable extends Bindable { |
| 979 final Node _node; | 982 final Node _node; |
| 980 final String _eventName; | 983 final String _eventName; |
| 981 final _model; | 984 final _model; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 if (_sub != null) { | 1020 if (_sub != null) { |
| 1018 if (_eventsLog.isLoggable(Level.FINE)) { | 1021 if (_eventsLog.isLoggable(Level.FINE)) { |
| 1019 _eventsLog.fine( | 1022 _eventsLog.fine( |
| 1020 'event.remove: [$_node].$_eventName => [$_model].$_path())'); | 1023 'event.remove: [$_node].$_eventName => [$_model].$_path())'); |
| 1021 } | 1024 } |
| 1022 _sub.cancel(); | 1025 _sub.cancel(); |
| 1023 _sub = null; | 1026 _sub = null; |
| 1024 } | 1027 } |
| 1025 } | 1028 } |
| 1026 } | 1029 } |
| OLD | NEW |