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

Side by Side Diff: packages/observe/lib/src/bindable.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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
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 library observe.src.bindable;
6
7 /// An object that can be data bound.
8 // Normally this is used with 'package:template_binding'.
9 // TODO(jmesserly): Node.bind polyfill calls this "observable"
10 abstract class Bindable {
11 // Dart note: changed setValue to be "set value" and discardChanges() to
12 // be "get value".
13
14 /// Initiates observation and returns the initial value.
15 /// The callback will be called with the updated [value].
16 ///
17 /// Some subtypes may chose to provide additional arguments, such as
18 /// [PathObserver] providing the old value as the second argument.
19 /// However, they must support callbacks with as few as 0 or 1 argument.
20 /// This can be implemented by performing an "is" type test on the callback.
21 open(callback);
22
23 /// Stops future notifications and frees the reference to the callback passed
24 /// to [open], so its memory can be collected even if this Bindable is alive.
25 void close();
26
27 /// Gets the current value of the bindings.
28 /// Note: once the value of a [Bindable] is fetched, the callback passed to
29 /// [open] should not be called again with this new value.
30 /// In other words, any pending change notifications must be discarded.
31 // TODO(jmesserly): I don't like a getter with side effects. Should we just
32 // rename the getter/setter pair to discardChanges/setValue like they are in
33 // JavaScript?
34 get value;
35
36 /// This can be implemented for two-way bindings. By default does nothing.
37 set value(newValue) {}
38
39 /// Deliver changes. Typically this will perform dirty-checking, if any is
40 /// needed.
41 void deliver() {}
42 }
OLDNEW
« no previous file with comments | « packages/observe/lib/src/bind_property.dart ('k') | packages/observe/lib/src/change_notifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698