Chromium Code Reviews| 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..b5fd5eb075a6e8ae1de34d84ec28b4e28be19ac0 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,20 @@ class _JsBindable extends Bindable { |
| JsObject bindableToJsObject(Bindable bindable) { |
| if (bindable is _JsBindable) return bindable._js; |
| + var zone = Zone.current; |
| + inZone(f) => zone.bindCallback(f); |
| + inZone1(f) => zone.bindUnaryCallback(f); |
|
jakemac
2014/07/30 21:05:06
might want to rename inZoneUnary, usually you don'
Siggi Cherem (dart-lang)
2014/07/30 21:21:47
Done.
|
| + |
| return new JsObject.jsify({ |
| - 'open': (callback) => bindable.open((x) => callback.apply([x])), |
| - 'close': () => bindable.close(), |
| - 'discardChanges': () => bindable.value, |
| - 'setValue': (x) => bindable.value = x, |
| + 'open': inZone1((callback) => bindable.open((x) => callback.apply([x]))), |
| + 'close': inZone(() => bindable.close()), |
| + 'discardChanges': inZone(() => bindable.value), |
| + 'setValue': inZone1((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 |
| }); |