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

Unified Diff: lib/templating.dart

Issue 12096106: work in progress: observable implementation using detailed change records (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: Created 7 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
« no previous file with comments | « lib/src/utils.dart ('k') | lib/watcher.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/templating.dart
diff --git a/lib/templating.dart b/lib/templating.dart
index 3f5693f2400065572969f2908a98d9f399120990..3063211294301461b72ccef7e1aae733a13135f0 100644
--- a/lib/templating.dart
+++ b/lib/templating.dart
@@ -10,6 +10,8 @@ import 'dart:html';
import 'dart:uri';
import 'package:web_ui/safe_html.dart';
import 'package:web_ui/watcher.dart';
+import 'package:web_ui/observe.dart';
+export 'src/utils.dart' show setImmediate;
/**
* Take the value of a bound expression and creates an HTML node with its value.
@@ -136,7 +138,7 @@ void updateCssClass(Element elem, bool addClasses, classes) {
* bindCssClasses(e, () => class1);
* bindCssClasses(e, () => class2);
*/
-WatcherDisposer bindCssClasses(Element elem, dynamic exp()) {
+ChangeUnobserver bindCssClasses(Element elem, dynamic exp()) {
return watchAndInvoke(exp, (e) {
updateCssClass(elem, false, e.oldValue);
updateCssClass(elem, true, e.newValue);
@@ -144,7 +146,7 @@ WatcherDisposer bindCssClasses(Element elem, dynamic exp()) {
}
/** Bind the result of [exp] to the style attribute in [elem]. */
-WatcherDisposer bindStyle(Element elem, Map<String, String> exp()) {
+ChangeUnobserver bindStyle(Element elem, Map<String, String> exp()) {
return watchAndInvoke(exp, (e) {
if (e.oldValue is Map<String, String>) {
var props = e.newValue;
@@ -237,8 +239,8 @@ class Listener extends TemplateItem {
/** Represents a generic data binding and a corresponding action. */
class Binding extends TemplateItem {
final exp;
- final ValueWatcher action;
- WatcherDisposer stopper;
+ final ChangeObserver action;
+ ChangeUnobserver stopper;
Binding(this.exp, this.action);
@@ -257,7 +259,7 @@ class Binding extends TemplateItem {
class StyleAttrBinding extends TemplateItem {
final exp;
final Element elem;
- WatcherDisposer stopper;
+ ChangeUnobserver stopper;
StyleAttrBinding(this.elem, this.exp);
@@ -276,7 +278,7 @@ class StyleAttrBinding extends TemplateItem {
class ClassAttrBinding extends TemplateItem {
final Element elem;
final exp;
- WatcherDisposer stopper;
+ ChangeUnobserver stopper;
ClassAttrBinding(this.elem, this.exp);
@@ -311,7 +313,7 @@ class DomPropertyBinding extends TemplateItem {
*/
final bool isUrl;
- WatcherDisposer stopper;
+ ChangeUnobserver stopper;
DomPropertyBinding(this.getter, this.setter, this.isUrl);
@@ -375,7 +377,7 @@ class Template extends TemplateItem {
}
/** Run [action] when [exp] changes (while this template is visible). */
- void bind(exp, ValueWatcher action) {
+ void bind(exp, ChangeObserver action) {
children.add(new Binding(exp, action));
}
@@ -488,7 +490,7 @@ abstract class PlaceholderTemplate extends Template {
/** Expression watch by this template (condition or loop expression). */
final exp;
- WatcherDisposer stopper;
+ ChangeUnobserver stopper;
PlaceholderTemplate(Node reference, this.exp)
: super(reference);
@@ -589,7 +591,7 @@ class LoopTemplate extends PlaceholderTemplate {
class LoopTemplateInAttribute extends Template {
final LoopIterationSetup iterSetup;
final exp;
- WatcherDisposer stopper;
+ ChangeUnobserver stopper;
LoopTemplateInAttribute(Node node, this.exp, this.iterSetup) : super(node);
« no previous file with comments | « lib/src/utils.dart ('k') | lib/watcher.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698