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

Unified Diff: pkg/template_binding/lib/src/node.dart

Issue 432533002: Run template binding callbacks in the correct zone (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 | « pkg/template_binding/CHANGELOG.md ('k') | pkg/template_binding/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/template_binding/lib/src/node.dart
diff --git a/pkg/template_binding/lib/src/node.dart b/pkg/template_binding/lib/src/node.dart
index 9df36d0bcc2c6c2b636bf1addae4e492f5000670..503b91a4c85fe13789e44673395344f94c1d002a 100644
--- a/pkg/template_binding/lib/src/node.dart
+++ b/pkg/template_binding/lib/src/node.dart
@@ -137,7 +137,8 @@ class _JsBindable extends Bindable {
final JsObject _js;
_JsBindable(JsObject obj) : _js = obj;
- open(callback) => _js.callMethod('open', [callback]);
+ open(callback) => _js.callMethod('open',
+ [Zone.current.bindUnaryCallback(callback)]);
close() => _js.callMethod('close');
@@ -155,16 +156,21 @@ class _JsBindable extends Bindable {
JsObject bindableToJsObject(Bindable bindable) {
if (bindable is _JsBindable) return bindable._js;
+ var zone = Zone.current;
+ inZone(f) => zone.bindCallback(f);
+ inZoneUnary(f) => zone.bindUnaryCallback(f);
+
return new JsObject.jsify({
- 'open': (callback) => bindable.open((x) => callback.apply([x])),
- 'close': () => bindable.close(),
- 'discardChanges': () => bindable.value,
- 'setValue': (x) => bindable.value = x,
+ 'open': inZoneUnary(
+ (callback) => bindable.open((x) => callback.apply([x]))),
+ 'close': inZone(() => bindable.close()),
+ 'discardChanges': inZone(() => bindable.value),
+ 'setValue': inZoneUnary((x) => bindable.value = x),
// NOTE: this is not used by Node.bind, but it's used by Polymer:
// https://github.com/Polymer/polymer-dev/blob/ba2b68fe5a5721f60b5994135f3270e63588809a/src/declaration/properties.js#L130
// Technically this works because 'deliver' is on PathObserver and
// CompoundObserver. But ideally Polymer-JS would not assume that.
- 'deliver': () => bindable.deliver(),
+ 'deliver': inZone(() => bindable.deliver()),
// Save this so we can return it from [jsObjectToBindable]
'__dartBindable': bindable
});
« no previous file with comments | « pkg/template_binding/CHANGELOG.md ('k') | pkg/template_binding/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698