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

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

Issue 132403010: big update to observe, template_binding, polymer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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
Index: pkg/observe/lib/src/bindable.dart
diff --git a/pkg/observe/lib/src/bindable.dart b/pkg/observe/lib/src/bindable.dart
new file mode 100644
index 0000000000000000000000000000000000000000..db994b4b6890e7cde434cacf570d905f20aaeca5
--- /dev/null
+++ b/pkg/observe/lib/src/bindable.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library observe.src.bindable;
+
+/// An object that can be data bound.
+// 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?
+ // TODO(jmesserly): not sure how I feel about open taking a variable number
+ // of arguments, but it's the easiest way to make CompoundObserver work.
+
+ /// Initiates observation and returns initial value.
Siggi Cherem (dart-lang) 2014/02/03 22:52:48 returns initial => returns the initial
Jennifer Messerly 2014/02/04 00:33:06 Done.
+ /// The callback will be called with updated value. Some subtypes may also
Siggi Cherem (dart-lang) 2014/02/03 22:52:48 with update => with the updated
Jennifer Messerly 2014/02/04 00:33:06 Done.
+ /// provide old value as the second argument, or other information. Regardless
Siggi Cherem (dart-lang) 2014/02/03 22:52:48 This was a bit confusing and I only understood wha
Jennifer Messerly 2014/02/04 00:33:06 attemped to reword this, also added more precise d
+ /// it should support functuons that accept a single argument.
Siggi Cherem (dart-lang) 2014/02/03 22:52:48 functiuons => functions
Jennifer Messerly 2014/02/04 00:33:06 Done.
+ open(callback);
+
+ /// Stops future notification and references to the callback passed to [open].
Siggi Cherem (dart-lang) 2014/02/03 22:52:48 notification -> notifications not sure what it mea
Jennifer Messerly 2014/02/04 00:33:06 reworded
+ void close();
+
+ /// Gets the current value of the bindings.
+ 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. Essentially the pending change is discarded.
Siggi Cherem (dart-lang) 2014/02/03 22:52:48 not sure what 'pending change' means here. Also -
Jennifer Messerly 2014/02/04 00:33:06 it's to avoid cycles in 2-way bindings, is my unde
+ set value(newValue) {}
+}

Powered by Google App Engine
This is Rietveld 408576698