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

Unified Diff: pkg/observe/lib/src/bindable.dart

Issue 355133002: switch Node.bind to interop (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 | « no previous file | pkg/observe/lib/src/observer_transform.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/observe/lib/src/bindable.dart
diff --git a/pkg/observe/lib/src/bindable.dart b/pkg/observe/lib/src/bindable.dart
index 4b628a60b82e3931ec67ecba50986bc090ac5e55..c3314a2b112b8431b291784e8f0eac3c6111efec 100644
--- a/pkg/observe/lib/src/bindable.dart
+++ b/pkg/observe/lib/src/bindable.dart
@@ -8,11 +8,8 @@ library observe.src.bindable;
// Normally this is used with 'package:template_binding'.
// TODO(jmesserly): Node.bind polyfill calls this "observable"
abstract class Bindable {
- // TODO(jmesserly): since we have "value", should open be a void method?
// Dart note: changed setValue to be "set value" and discardChanges() to
- // be "get value". Also "set value" implies discard changes.
- // TOOD(jmesserly): is this change too subtle? Is there any other way to
- // make Bindable friendly in a world with getters/setters?
+ // be "get value".
/// Initiates observation and returns the initial value.
/// The callback will be called with the updated [value].
@@ -28,10 +25,18 @@ abstract class Bindable {
void close();
/// Gets the current value of the bindings.
+ /// Note: once the value of a [Bindable] is fetched, the callback passed to
+ /// [open] should not be called again with this new value.
+ /// In other words, any pending change notifications must be discarded.
+ // TODO(jmesserly): I don't like a getter with side effects. Should we just
+ // rename the getter/setter pair to discardChanges/setValue like they are in
+ // JavaScript?
get value;
/// This can be implemented for two-way bindings. By default does nothing.
- /// Note: setting the value of a [Bindable] must not call the [callback] with
- /// the new value. Any pending change notifications must be discarded.
set value(newValue) {}
+
+ /// Deliver changes. Typically this will perform dirty-checking, if any is
+ /// needed.
+ void deliver() {}
}
« no previous file with comments | « no previous file | pkg/observe/lib/src/observer_transform.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698