| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 library observable; | 5 library observable; |
| 6 | 6 |
| 7 part 'ChangeEvent.dart'; | 7 part 'ChangeEvent.dart'; |
| 8 part 'EventBatch.dart'; | 8 part 'EventBatch.dart'; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 254 |
| 255 List getRange(int start, int length) { | 255 List getRange(int start, int length) { |
| 256 throw new UnimplementedError(); | 256 throw new UnimplementedError(); |
| 257 } | 257 } |
| 258 | 258 |
| 259 // Iterable<T>: | 259 // Iterable<T>: |
| 260 Iterator<T> iterator() => _internal.iterator(); | 260 Iterator<T> iterator() => _internal.iterator(); |
| 261 | 261 |
| 262 // Collection<T>: | 262 // Collection<T>: |
| 263 Collection<T> where(bool f(T element)) => _internal.where(f); | 263 Collection<T> where(bool f(T element)) => _internal.where(f); |
| 264 Collection mappedBy(f(T element)) => _internal.mappedBy(f); | 264 Iterable mappedBy(f(T element)) => _internal.mappedBy(f); |
| 265 bool every(bool f(T element)) => _internal.every(f); | 265 bool every(bool f(T element)) => _internal.every(f); |
| 266 bool some(bool f(T element)) => _internal.some(f); | 266 bool some(bool f(T element)) => _internal.some(f); |
| 267 void forEach(void f(T element)) { _internal.forEach(f); } | 267 void forEach(void f(T element)) { _internal.forEach(f); } |
| 268 bool get isEmpty => length == 0; | 268 bool get isEmpty => length == 0; |
| 269 } | 269 } |
| 270 | 270 |
| 271 // TODO(jmesserly): is this too granular? Other similar systems make whole | 271 // TODO(jmesserly): is this too granular? Other similar systems make whole |
| 272 // classes observable instead of individual fields. The memory cost of having | 272 // classes observable instead of individual fields. The memory cost of having |
| 273 // every field effectively boxed, plus having a listeners list is likely too | 273 // every field effectively boxed, plus having a listeners list is likely too |
| 274 // much. Also, making a value observable necessitates adding ".value" to lots | 274 // much. Also, making a value observable necessitates adding ".value" to lots |
| (...skipping 10 matching lines...) Expand all Loading... |
| 285 // Only fire on an actual change. | 285 // Only fire on an actual change. |
| 286 if (!identical(newValue, _value)) { | 286 if (!identical(newValue, _value)) { |
| 287 final oldValue = _value; | 287 final oldValue = _value; |
| 288 _value = newValue; | 288 _value = newValue; |
| 289 recordPropertyUpdate("value", newValue, oldValue); | 289 recordPropertyUpdate("value", newValue, oldValue); |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 | 292 |
| 293 T _value; | 293 T _value; |
| 294 } | 294 } |
| OLD | NEW |