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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 add(element); | 177 add(element); |
178 } | 178 } |
179 } | 179 } |
180 | 180 |
181 int push(T element) { | 181 int push(T element) { |
182 recordListInsert(length, element); | 182 recordListInsert(length, element); |
183 _internal.add(element); | 183 _internal.add(element); |
184 return _internal.length; | 184 return _internal.length; |
185 } | 185 } |
186 | 186 |
187 T get first => _internal.first; | |
188 T get last => _internal.last; | 187 T get last => _internal.last; |
189 | 188 |
190 T removeLast() { | 189 T removeLast() { |
191 final result = _internal.removeLast(); | 190 final result = _internal.removeLast(); |
192 recordListRemove(length, result); | 191 recordListRemove(length, result); |
193 return result; | 192 return result; |
194 } | 193 } |
195 | 194 |
196 T removeAt(int index) { | 195 T removeAt(int index) { |
197 int i = 0; | 196 int i = 0; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 // Only fire on an actual change. | 285 // Only fire on an actual change. |
287 if (!identical(newValue, _value)) { | 286 if (!identical(newValue, _value)) { |
288 final oldValue = _value; | 287 final oldValue = _value; |
289 _value = newValue; | 288 _value = newValue; |
290 recordPropertyUpdate("value", newValue, oldValue); | 289 recordPropertyUpdate("value", newValue, oldValue); |
291 } | 290 } |
292 } | 291 } |
293 | 292 |
294 T _value; | 293 T _value; |
295 } | 294 } |
OLD | NEW |