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

Unified Diff: pkg/observe/lib/src/observable.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/observe/lib/src/metadata.dart ('k') | pkg/observe/lib/src/observable_box.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/observe/lib/src/observable.dart
diff --git a/pkg/observe/lib/src/observable.dart b/pkg/observe/lib/src/observable.dart
index 35e91c8912e989ececca48a1e89f0f74c384c686..d42963fe99a9c4b93856520a0a1ca038a5daf90c 100644
--- a/pkg/observe/lib/src/observable.dart
+++ b/pkg/observe/lib/src/observable.dart
@@ -23,26 +23,22 @@ import 'package:observe/observe.dart';
// above.
import 'dirty_check.dart';
-/**
- * Represents an object with observable properties. This is used by data in
- * model-view architectures to notify interested parties of [changes] to the
- * object's properties (fields or getter/setter pairs).
- *
- * The interface does not require any specific technique to implement
- * observability. You can implement it in the following ways:
- *
- * - extend or mixin this class, and let the application call [dirtyCheck]
- * periodically to check for changes to your object.
- * - extend or mixin [ChangeNotifier], and implement change notifications
- * manually by calling [notifyPropertyChange] from your setters.
- * - implement this interface and provide your own implementation.
- */
+/// Represents an object with observable properties. This is used by data in
+/// model-view architectures to notify interested parties of [changes] to the
+/// object's properties (fields or getter/setter pairs).
+///
+/// The interface does not require any specific technique to implement
+/// observability. You can implement it in the following ways:
+///
+/// - extend or mixin this class, and let the application call [dirtyCheck]
+/// periodically to check for changes to your object.
+/// - extend or mixin [ChangeNotifier], and implement change notifications
+/// manually by calling [notifyPropertyChange] from your setters.
+/// - implement this interface and provide your own implementation.
abstract class Observable {
- /**
- * Performs dirty checking of objects that inherit from [Observable].
- * This scans all observed objects using mirrors and determines if any fields
- * have changed. If they have, it delivers the changes for the object.
- */
+ /// Performs dirty checking of objects that inherit from [Observable].
+ /// This scans all observed objects using mirrors and determines if any fields
+ /// have changed. If they have, it delivers the changes for the object.
static void dirtyCheck() => dirtyCheckObservables();
StreamController _changes;
@@ -51,12 +47,10 @@ abstract class Observable {
Map<Symbol, Object> _values;
List<ChangeRecord> _records;
- /**
- * The stream of change records to this object. Records will be delivered
- * asynchronously.
- *
- * [deliverChanges] can be called to force synchronous delivery.
- */
+ /// The stream of change records to this object. Records will be delivered
+ /// asynchronously.
+ ///
+ /// [deliverChanges] can be called to force synchronous delivery.
Stream<List<ChangeRecord>> get changes {
if (_changes == null) {
_changes = new StreamController.broadcast(sync: true,
@@ -65,10 +59,8 @@ abstract class Observable {
return _changes.stream;
}
- /**
- * True if this object has any observers, and should call
- * [notifyChange] for changes.
- */
+ /// True if this object has any observers, and should call
+ /// [notifyChange] for changes.
bool get hasObservers => _changes != null && _changes.hasListener;
void _observed() {
@@ -104,7 +96,7 @@ abstract class Observable {
_values = values;
}
- /** Release data associated with observation. */
+ /// Release data associated with observation.
void _unobserved() {
// Note: we don't need to explicitly unregister from the dirty check list.
// This will happen automatically at the next call to dirtyCheck.
@@ -114,10 +106,8 @@ abstract class Observable {
}
}
- /**
- * Synchronously deliver pending [changes]. Returns true if any records were
- * delivered, otherwise false.
- */
+ /// Synchronously deliver pending [changes]. Returns true if any records were
+ /// delivered, otherwise false.
// TODO(jmesserly): this is a bit different from the ES Harmony version, which
// allows delivery of changes to a particular observer:
// http://wiki.ecmascript.org/doku.php?id=harmony:observe#object.deliverchangerecords
@@ -159,30 +149,26 @@ abstract class Observable {
return true;
}
- /**
- * Notify that the field [name] of this object has been changed.
- *
- * The [oldValue] and [newValue] are also recorded. If the two values are
- * equal, no change will be recorded.
- *
- * For convenience this returns [newValue].
- */
+ /// Notify that the field [name] of this object has been changed.
+ ///
+ /// The [oldValue] and [newValue] are also recorded. If the two values are
+ /// equal, no change will be recorded.
+ ///
+ /// For convenience this returns [newValue].
notifyPropertyChange(Symbol field, Object oldValue, Object newValue)
=> notifyPropertyChangeHelper(this, field, oldValue, newValue);
- /**
- * Notify observers of a change.
- *
- * For most objects [Observable.notifyPropertyChange] is more convenient, but
- * collections sometimes deliver other types of changes such as a
- * [ListChangeRecord].
- *
- * Notes:
- * - This is *not* required for fields if you mixin or extend [Observable],
- * but you can use it for computed properties.
- * - Unlike [ChangeNotifier] this will not schedule [deliverChanges]; use
- * [Observable.dirtyCheck] instead.
- */
+ /// Notify observers of a change.
+ ///
+ /// For most objects [Observable.notifyPropertyChange] is more convenient, but
+ /// collections sometimes deliver other types of changes such as a
+ /// [ListChangeRecord].
+ ///
+ /// Notes:
+ /// - This is *not* required for fields if you mixin or extend [Observable],
+ /// but you can use it for computed properties.
+ /// - Unlike [ChangeNotifier] this will not schedule [deliverChanges]; use
+ /// [Observable.dirtyCheck] instead.
void notifyChange(ChangeRecord record) {
if (!hasObservers) return;
« no previous file with comments | « pkg/observe/lib/src/metadata.dart ('k') | pkg/observe/lib/src/observable_box.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698