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

Side by Side Diff: pkg/polymer_expressions/lib/polymer_expressions.dart

Issue 27618002: package:observe fix various api issues (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « pkg/polymer_expressions/lib/eval.dart ('k') | pkg/polymer_expressions/test/bindings_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * A binding delegate used with Polymer elements that 6 * A binding delegate used with Polymer elements that
7 * allows for complex binding expressions, including 7 * allows for complex binding expressions, including
8 * property access, function invocation, 8 * property access, function invocation,
9 * list/map indexing, and two-way filtering. 9 * list/map indexing, and two-way filtering.
10 * 10 *
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 getInstanceModel(Element template, model) { 84 getInstanceModel(Element template, model) {
85 if (model is! Scope) { 85 if (model is! Scope) {
86 var _scope = new Scope(model: model, variables: globals); 86 var _scope = new Scope(model: model, variables: globals);
87 return _scope; 87 return _scope;
88 } 88 }
89 return model; 89 return model;
90 } 90 }
91 } 91 }
92 92
93 class _Binding extends ChangeNotifierBase { 93 class _Binding extends ChangeNotifier {
94 final Scope _scope; 94 final Scope _scope;
95 final ExpressionObserver _expr; 95 final ExpressionObserver _expr;
96 final _converter; 96 final _converter;
97 var _value; 97 var _value;
98 98
99 _Binding(Expression expr, Scope scope, [this._converter]) 99 _Binding(Expression expr, Scope scope, [this._converter])
100 : _expr = observe(expr, scope), 100 : _expr = observe(expr, scope),
101 _scope = scope { 101 _scope = scope {
102 _expr.onUpdate.listen(_setValue).onError((e) { 102 _expr.onUpdate.listen(_setValue).onError((e) {
103 _logger.warning("Error evaluating expression '$_expr': ${e.message}"); 103 _logger.warning("Error evaluating expression '$_expr': ${e.message}");
(...skipping 26 matching lines...) Expand all
130 @reflectable get value => _value; 130 @reflectable get value => _value;
131 131
132 @reflectable set value(v) { 132 @reflectable set value(v) {
133 try { 133 try {
134 assign(_expr, v, _scope); 134 assign(_expr, v, _scope);
135 } on EvalException catch (e) { 135 } on EvalException catch (e) {
136 // silently swallow binding errors 136 // silently swallow binding errors
137 } 137 }
138 } 138 }
139 } 139 }
OLDNEW
« no previous file with comments | « pkg/polymer_expressions/lib/eval.dart ('k') | pkg/polymer_expressions/test/bindings_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698