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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 void set length(int value) { | 151 void set length(int value) { |
152 _internal.length = value; | 152 _internal.length = value; |
153 recordGlobalChange(); | 153 recordGlobalChange(); |
154 } | 154 } |
155 | 155 |
156 void clear() { | 156 void clear() { |
157 _internal.clear(); | 157 _internal.clear(); |
158 recordGlobalChange(); | 158 recordGlobalChange(); |
159 } | 159 } |
160 | 160 |
161 void sort([Comparator compare = Comparable.compare]) { | 161 void sort([int compare(var a, var b)]) { |
| 162 if (compare == null) compare = Comparable.compare; |
162 _internal.sort(compare); | 163 _internal.sort(compare); |
163 recordGlobalChange(); | 164 recordGlobalChange(); |
164 } | 165 } |
165 | 166 |
166 void add(T element) { | 167 void add(T element) { |
167 recordListInsert(length, element); | 168 recordListInsert(length, element); |
168 _internal.add(element); | 169 _internal.add(element); |
169 } | 170 } |
170 | 171 |
171 void addLast(T element) { | 172 void addLast(T element) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 // Only fire on an actual change. | 287 // Only fire on an actual change. |
287 if (!identical(newValue, _value)) { | 288 if (!identical(newValue, _value)) { |
288 final oldValue = _value; | 289 final oldValue = _value; |
289 _value = newValue; | 290 _value = newValue; |
290 recordPropertyUpdate("value", newValue, oldValue); | 291 recordPropertyUpdate("value", newValue, oldValue); |
291 } | 292 } |
292 } | 293 } |
293 | 294 |
294 T _value; | 295 T _value; |
295 } | 296 } |
OLD | NEW |