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

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

Issue 14732003: Implement Model-Driven-Views spec for Dart (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: small fix Created 7 years, 7 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /**
6 * *Warning*: this library is experimental, and APIs are subject to change.
7 *
8 * This library is used to observe changes to [Observable] types. It also
Lasse Reichstein Nielsen 2013/05/06 10:58:58 I think the Observable name is too generic. This i
Jennifer Messerly 2013/05/07 05:43:38 It's intended for all observable objects. List and
9 * has helpers to implement [Observable] objects.
10 *
11 * For example:
12 *
13 * class Monster extends ObservableMixin {
floitsch 2013/05/06 17:37:46 As written in the other file: I don't like to exte
Jennifer Messerly 2013/05/07 05:43:38 Done.
14 * int _health = 100;
15 * static const _HEALTH = 'health';
16 * get health => _health;
17 * set health(value) {
18 * _health = notifyChange(_HEALTH, _health, value);
19 * }
20 * void damage(int amount) {
21 * print('$this takes $amount damage!');
22 * health -= amount;
23 * }
24 * toString() => 'Monster';
25 *
26 * // These methods are temporary until dart2js supports mirrors.
27 * getValue(key) {
28 * if (key == _HEALTH) return health;
29 * return null;
30 * }
31 * setValue(key, val) {
32 * if (key == _HEALTH) health = val;
33 * }
34 * }
35 *
36 * main() {
37 * var obj = new Monster();
38 * obj.changes.listen((records) {
39 * print('Changes to $obj were: $records');
40 * });
41 * // Asynchronously schedules delivery of these changes
Lasse Reichstein Nielsen 2013/05/06 10:58:58 "Schedules asynchronous ..."? (Nitpick - the sche
Jennifer Messerly 2013/05/07 05:43:38 Done.
42 * obj.damage(10);
43 * obj.damage(20);
44 * print('done!');
45 * }
46 */
47 library dart.observe;
48
49 import 'dart:async';
50 import 'dart:collection';
51 import 'dart:math' as math;
52
53 part 'list_diff.dart';
54 part 'observe_path.dart';
55 part 'observable.dart';
56 part 'observable_box.dart';
57 part 'observable_list.dart';
58 part 'observable_map.dart';
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698