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

Unified Diff: pkg/polymer/lib/src/events.dart

Issue 469823002: Roll polymer to 0.3.5 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: upgrade web_components Created 6 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 side-by-side diff with in-line comments
Download patch
Index: pkg/polymer/lib/src/events.dart
diff --git a/pkg/polymer/lib/src/events.dart b/pkg/polymer/lib/src/events.dart
index ccf07861513ee26d3d4a6586cd810ce44d860f1d..1467136d68e33379d57fe9cf3b142d75a274b756 100644
--- a/pkg/polymer/lib/src/events.dart
+++ b/pkg/polymer/lib/src/events.dart
@@ -88,21 +88,25 @@ abstract class PolymerEventBindings {
eventType = translated != null ? translated : eventType;
return (model, node, oneTime) {
- var handler = getEventHandler(null, node, path);
- var sub = node.on[eventType].listen(handler);
+ var handler = Zone.current.bindUnaryCallback(
+ getEventHandler(null, node, path));
+ _PolymerGestures.callMethod(
+ 'addEventListener', [node, eventType, handler]);
if (oneTime) return null;
- return new _EventBindable(sub, path);
+ return new _EventBindable(path, node, eventType, handler);
};
}
}
class _EventBindable extends Bindable {
- StreamSubscription _sub;
final String _path;
+ final Node _node;
+ final String _eventType;
+ final ZoneUnaryCallback _handler;
Siggi Cherem (dart-lang) 2014/08/14 20:51:24 we should leave the type as it was - I think the r
- _EventBindable(this._sub, this._path);
+ _EventBindable(this._path, this._node, this._eventType, this._handler);
// TODO(rafaelw): This is really pointless work. Aside from the cost
// of these allocations, NodeBind is going to setAttribute back to its
@@ -113,10 +117,9 @@ class _EventBindable extends Bindable {
open(callback) => value;
void close() {
- if (_sub != null) {
- _sub.cancel();
- _sub = null;
- }
+ _PolymerGestures.callMethod(
+ 'removeEventListener',
+ [_node, _eventType, _handler]);
Siggi Cherem (dart-lang) 2014/08/14 20:51:24 you might not need the line-wrap
}
}

Powered by Google App Engine
This is Rietveld 408576698