| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 set combinator(CompoundBindingCombinator combinator) { | 51 set combinator(CompoundBindingCombinator combinator) { |
| 52 _combinator = combinator; | 52 _combinator = combinator; |
| 53 if (combinator != null) _scheduleResolve(); | 53 if (combinator != null) _scheduleResolve(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 static const _VALUE = const Symbol('value'); | 56 static const _VALUE = const Symbol('value'); |
| 57 | 57 |
| 58 get value => _value; | 58 get value => _value; |
| 59 | 59 |
| 60 int get length => _bindings.length; |
| 61 |
| 60 void set value(newValue) { | 62 void set value(newValue) { |
| 61 _value = notifyPropertyChange(_VALUE, _value, newValue); | 63 _value = notifyPropertyChange(_VALUE, _value, newValue); |
| 62 } | 64 } |
| 63 | 65 |
| 64 void bind(name, model, String path) { | 66 void bind(name, model, String path) { |
| 65 unbind(name); | 67 unbind(name); |
| 66 | 68 |
| 67 // TODO(jmesserly): should we avoid observing until we are observed, | 69 // TODO(jmesserly): should we avoid observing until we are observed, |
| 68 // similar to PathObserver? Similar for unobserving? | 70 // similar to PathObserver? Similar for unobserving? |
| 69 _bindings[name] = new PathObserver(model, path).bindSync((value) { | 71 _bindings[name] = new PathObserver(model, path).bindSync((value) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 for (var binding in _bindings.values) { | 108 for (var binding in _bindings.values) { |
| 107 binding.cancel(); | 109 binding.cancel(); |
| 108 } | 110 } |
| 109 _bindings.clear(); | 111 _bindings.clear(); |
| 110 _values.clear(); | 112 _values.clear(); |
| 111 | 113 |
| 112 _disposed = true; | 114 _disposed = true; |
| 113 value = null; | 115 value = null; |
| 114 } | 116 } |
| 115 } | 117 } |
| OLD | NEW |