Index: tools/dom/templates/html/impl/impl_Geolocation.darttemplate |
diff --git a/tools/dom/templates/html/impl/impl_Geolocation.darttemplate b/tools/dom/templates/html/impl/impl_Geolocation.darttemplate |
index 19447c27f7a833eece15178adbd5dbb54a6dcd99..c4fec21188aa25037d7711fa795c472c8a4b3870 100644 |
--- a/tools/dom/templates/html/impl/impl_Geolocation.darttemplate |
+++ b/tools/dom/templates/html/impl/impl_Geolocation.darttemplate |
@@ -54,21 +54,20 @@ $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
int watchId; |
var controller; |
controller = new StreamController<Geoposition>( |
- onSubscriptionStateChange: () { |
- if (controller.hasListener) { |
- assert(watchId == null); |
- watchId = $dom_watchPosition( |
- (position) { |
- controller.add(_ensurePosition(position)); |
- }, |
- (error) { |
- controller.addError(error); |
- }, |
- options); |
- } else { |
- assert(watchId != null); |
- $dom_clearWatch(watchId); |
- } |
+ onListen: () { |
+ assert(watchId == null); |
+ watchId = $dom_watchPosition( |
+ (position) { |
+ controller.add(_ensurePosition(position)); |
+ }, |
+ (error) { |
+ controller.addError(error); |
+ }, |
+ options); |
+ }, |
+ onCancel: () { |
+ assert(watchId != null); |
+ $dom_clearWatch(watchId); |
}); |
return controller.stream; |