OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 * A library for observing changes to observable Dart objects. | 6 * A library for observing changes to observable Dart objects. |
7 * Similar in spirit to EcmaScript Harmony | 7 * Similar in spirit to EcmaScript Harmony |
8 * [Object.observe](http://wiki.ecmascript.org/doku.php?id=harmony:observe), but | 8 * [Object.observe](http://wiki.ecmascript.org/doku.php?id=harmony:observe), but |
9 * able to observe expressions and not just objects, so long as the expressions | 9 * able to observe expressions and not just objects, so long as the expressions |
10 * are computed from observable objects. | 10 * are computed from observable objects. |
11 * | 11 * |
12 * See the `observable` annotation and the `observe` function. | 12 * See the `observable` annotation and the `observe` function. |
13 */ | 13 */ |
14 // Note: one intentional difference from Harmony Object.observe is that our | 14 // Note: one intentional difference from Harmony Object.observe is that our |
15 // change batches are tracked on a per-observed expression basis, instead of | 15 // change batches are tracked on a per-observed expression basis, instead of |
16 // per-observer basis. | 16 // per-observer basis. |
17 // We do this because there is no cheap way to store data on a Dart | 17 // We do this because there is no cheap way to store data on a Dart |
18 // function (Expando uses linear search on the VM: http://dartbug.com/7558). | 18 // function (Expando uses linear search on the VM: http://dartbug.com/7558). |
19 // This difference means that a given observer will be called with one batch of | 19 // This difference means that a given observer will be called with one batch of |
20 // changes for each object it is observing. | 20 // changes for each object it is observing. |
21 // TODO(jmesserly): this behavior is not ideal. It's really powerful to be able | 21 // TODO(jmesserly): this behavior is not ideal. It's really powerful to be able |
22 // to get all changes in one "transaction". We should look at alternate | 22 // to get all changes in one "transaction". We should look at alternate |
23 // approaches. | 23 // approaches. |
24 library observe; | 24 library web_ui.observe; |
25 | 25 |
26 export 'observe/list.dart'; | 26 export 'observe/list.dart'; |
27 export 'observe/map.dart'; | 27 export 'observe/map.dart'; |
28 export 'observe/reference.dart'; | 28 export 'observe/reference.dart'; |
29 export 'observe/set.dart'; | 29 export 'observe/set.dart'; |
30 | 30 |
31 export 'observe/observable.dart' | 31 export 'observe/observable.dart' |
32 // Hide methods that are only used when implementing Observable: | 32 // Hide methods that are only used when implementing Observable: |
33 hide hasObservers, observeReads, notifyChange, notifyRead; | 33 hide hasObservers, observeReads, notifyChange, notifyRead; |
OLD | NEW |