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

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

Issue 26734004: use symbol literals instead of const ctor in packages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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/html.dart ('k') | pkg/observe/lib/src/bind_property.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 /** 5 /**
6 * Support for observing changes in model-view architectures. 6 * Support for observing changes in model-view architectures.
7 * 7 *
8 * **Warning:** This library is experimental, and APIs are subject to change. 8 * **Warning:** This library is experimental, and APIs are subject to change.
9 * 9 *
10 * This library is used to observe changes to [Observable] types. It also 10 * This library is used to observe changes to [Observable] types. It also
(...skipping 27 matching lines...) Expand all
38 * } 38 * }
39 * 39 *
40 * A more sophisticated approach is to implement the change notification 40 * A more sophisticated approach is to implement the change notification
41 * manually. This avoids the potentially expensive [Observable.dirtyCheck] 41 * manually. This avoids the potentially expensive [Observable.dirtyCheck]
42 * operation, but requires more work in the object: 42 * operation, but requires more work in the object:
43 * 43 *
44 * class Monster extends Unit with ChangeNotifierMixin { 44 * class Monster extends Unit with ChangeNotifierMixin {
45 * int _health = 100; 45 * int _health = 100;
46 * get health => _health; 46 * get health => _health;
47 * set health(val) { 47 * set health(val) {
48 * _health = notifyPropertyChange(const Symbol('health'), _health, val); 48 * _health = notifyPropertyChange(#health, _health, val);
49 * } 49 * }
50 * 50 *
51 * void damage(int amount) { 51 * void damage(int amount) {
52 * print('$this takes $amount damage!'); 52 * print('$this takes $amount damage!');
53 * health -= amount; 53 * health -= amount;
54 * } 54 * }
55 * 55 *
56 * toString() => 'Monster with $health hit points'; 56 * toString() => 'Monster with $health hit points';
57 * } 57 * }
58 * 58 *
(...skipping 27 matching lines...) Expand all
86 part 'src/change_notifier.dart'; 86 part 'src/change_notifier.dart';
87 part 'src/change_record.dart'; 87 part 'src/change_record.dart';
88 part 'src/compound_binding.dart'; 88 part 'src/compound_binding.dart';
89 part 'src/list_path_observer.dart'; 89 part 'src/list_path_observer.dart';
90 part 'src/observable.dart'; 90 part 'src/observable.dart';
91 part 'src/observable_box.dart'; 91 part 'src/observable_box.dart';
92 part 'src/observable_list.dart'; 92 part 'src/observable_list.dart';
93 part 'src/observable_map.dart'; 93 part 'src/observable_map.dart';
94 part 'src/path_observer.dart'; 94 part 'src/path_observer.dart';
95 part 'src/to_observable.dart'; 95 part 'src/to_observable.dart';
OLDNEW
« no previous file with comments | « pkg/observe/lib/html.dart ('k') | pkg/observe/lib/src/bind_property.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698