| 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 observe; | 5 part of observe; |
| 6 | 6 |
| 7 /** The callback used in the [CompoundBinding.combinator] field. */ | 7 /** The callback used in the [CompoundBinding.combinator] field. */ |
| 8 typedef Object CompoundBindingCombinator(Map objects); | 8 typedef Object CompoundBindingCombinator(Map objects); |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 this.combinator = combinator; | 58 this.combinator = combinator; |
| 59 } | 59 } |
| 60 | 60 |
| 61 CompoundBindingCombinator get combinator => _combinator; | 61 CompoundBindingCombinator get combinator => _combinator; |
| 62 | 62 |
| 63 set combinator(CompoundBindingCombinator combinator) { | 63 set combinator(CompoundBindingCombinator combinator) { |
| 64 _combinator = combinator; | 64 _combinator = combinator; |
| 65 if (combinator != null) _scheduleResolve(); | 65 if (combinator != null) _scheduleResolve(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 get value => _value; | |
| 69 | |
| 70 int get length => _observers.length; | 68 int get length => _observers.length; |
| 71 | 69 |
| 72 void set value(newValue) { | 70 @reflectable get value => _value; |
| 71 |
| 72 @reflectable void set value(newValue) { |
| 73 _value = notifyPropertyChange(#value, _value, newValue); | 73 _value = notifyPropertyChange(#value, _value, newValue); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void bind(name, model, String path) { | 76 void bind(name, model, String path) { |
| 77 unbind(name); | 77 unbind(name); |
| 78 | 78 |
| 79 // TODO(jmesserly): should we delay observing until we are observed, | 79 // TODO(jmesserly): should we delay observing until we are observed, |
| 80 // similar to PathObserver? | 80 // similar to PathObserver? |
| 81 _observers[name] = new PathObserver(model, path).bindSync((value) { | 81 _observers[name] = new PathObserver(model, path).bindSync((value) { |
| 82 _values[name] = value; | 82 _values[name] = value; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 for (var binding in _observers.values) { | 124 for (var binding in _observers.values) { |
| 125 binding.cancel(); | 125 binding.cancel(); |
| 126 } | 126 } |
| 127 _observers.clear(); | 127 _observers.clear(); |
| 128 _values.clear(); | 128 _values.clear(); |
| 129 value = null; | 129 value = null; |
| 130 } | 130 } |
| 131 | 131 |
| 132 _unobserved() => close(); | 132 _unobserved() => close(); |
| 133 } | 133 } |
| OLD | NEW |