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

Side by Side Diff: lib/observe/map.dart

Issue 22280002: use custom_element pkg (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: Created 7 years, 4 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
« no previous file with comments | « no previous file | lib/web_ui.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 web_ui.observe.map; 5 library web_ui.observe.map;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'observable.dart'; 8 import 'observable.dart';
9 9
10 typedef Map<K, V> MapFactory<K, V>(); 10 typedef Map<K, V> MapFactory<K, V>();
(...skipping 25 matching lines...) Expand all
36 // TODO(jmesserly): removed type annotation to workaround: 36 // TODO(jmesserly): removed type annotation to workaround:
37 // https://code.google.com/p/dart/issues/detail?id=11540 37 // https://code.google.com/p/dart/issues/detail?id=11540
38 ObservableMap.linked() : this(createMap: () => new LinkedHashMap/*<K, V>*/()); 38 ObservableMap.linked() : this(createMap: () => new LinkedHashMap/*<K, V>*/());
39 39
40 /** Creates a new observable map using a [SplayTreeMap]. */ 40 /** Creates a new observable map using a [SplayTreeMap]. */
41 ObservableMap.sorted() : this(createMap: () => new SplayTreeMap/*<K, V>*/()); 41 ObservableMap.sorted() : this(createMap: () => new SplayTreeMap/*<K, V>*/());
42 42
43 /** 43 /**
44 * Creates an observable map that contains all key value pairs of [other]. 44 * Creates an observable map that contains all key value pairs of [other].
45 */ 45 */
46 factory ObservableMap.from(Map<K, V> other, {MapFactory<K, V> createMap}) { 46 factory ObservableMap.from(Map/*<K, V>*/ other, {MapFactory/*<K, V>*/ createMa p}) {
Siggi Cherem (dart-lang) 2013/08/05 22:02:06 80 col
Jennifer Messerly 2013/08/06 16:35:33 Done.
47 var result = new ObservableMap<K, V>(createMap: createMap); 47 var result = new ObservableMap/*<K, V>*/(createMap: createMap);
48 other.forEach((K key, V value) { result[key] = value; }); 48 other.forEach((/*K*/ key, /*V*/value) { result[key] = value; });
49 return result; 49 return result;
50 } 50 }
51 51
52 52
53 Iterable<K> get keys => _keys; 53 Iterable<K> get keys => _keys;
54 54
55 Iterable<V> get values => _values; 55 Iterable<V> get values => _values;
56 56
57 int get length { 57 int get length {
58 if (observeReads) notifyRead(this, ChangeRecord.FIELD, 'length'); 58 if (observeReads) notifyRead(this, ChangeRecord.FIELD, 'length');
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 throw new StateError('keys and values should be the same length'); 201 throw new StateError('keys and values should be the same length');
202 } 202 }
203 return _hasNext = moreValues; 203 return _hasNext = moreValues;
204 } 204 }
205 205
206 V get current { 206 V get current {
207 if (observeReads && _hasNext) _map._notifyReadKey(_keys.current); 207 if (observeReads && _hasNext) _map._notifyReadKey(_keys.current);
208 return _values.current; 208 return _values.current;
209 } 209 }
210 } 210 }
OLDNEW
« no previous file with comments | « no previous file | lib/web_ui.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698