Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(759)

Side by Side Diff: pkg/observe/lib/src/list_path_observer.dart

Issue 178683003: [observe] use consistent comment style (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/observe/lib/src/list_diff.dart ('k') | pkg/observe/lib/src/metadata.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 library observe.src.list_path_observer; 5 library observe.src.list_path_observer;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:observe/observe.dart'; 8 import 'package:observe/observe.dart';
9 9
10 // Inspired by ArrayReduction at: 10 // Inspired by ArrayReduction at:
11 // https://raw.github.com/rafaelw/ChangeSummary/master/util/array_reduction.js 11 // https://raw.github.com/rafaelw/ChangeSummary/master/util/array_reduction.js
12 // The main difference is we support anything on the rich Dart Iterable API. 12 // The main difference is we support anything on the rich Dart Iterable API.
13 13
14 /** 14 /// Observes a path starting from each item in the list.
15 * Observes a path starting from each item in the list.
16 */
17 class ListPathObserver<E, P> extends ChangeNotifier { 15 class ListPathObserver<E, P> extends ChangeNotifier {
18 final ObservableList<E> list; 16 final ObservableList<E> list;
19 final String _itemPath; 17 final String _itemPath;
20 final List<PathObserver> _observers = <PathObserver>[]; 18 final List<PathObserver> _observers = <PathObserver>[];
21 final List<StreamSubscription> _subs = <StreamSubscription>[]; 19 final List<StreamSubscription> _subs = <StreamSubscription>[];
22 StreamSubscription _sub; 20 StreamSubscription _sub;
23 bool _scheduled = false; 21 bool _scheduled = false;
24 Iterable<P> _value; 22 Iterable<P> _value;
25 23
26 ListPathObserver(this.list, String path) 24 ListPathObserver(this.list, String path)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 66 }
69 } else if (lengthAdjust < 0) { 67 } else if (lengthAdjust < 0) {
70 for (int i = 0; i < -lengthAdjust; i++) { 68 for (int i = 0; i < -lengthAdjust; i++) {
71 _subs.removeLast().cancel(); 69 _subs.removeLast().cancel();
72 } 70 }
73 int len = _observers.length; 71 int len = _observers.length;
74 _observers.removeRange(len + lengthAdjust, len); 72 _observers.removeRange(len + lengthAdjust, len);
75 } 73 }
76 } 74 }
77 } 75 }
OLDNEW
« no previous file with comments | « pkg/observe/lib/src/list_diff.dart ('k') | pkg/observe/lib/src/metadata.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698