From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/fr/web/api/geolocation/clearwatch/index.html | 143 +++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 files/fr/web/api/geolocation/clearwatch/index.html (limited to 'files/fr/web/api/geolocation/clearwatch') diff --git a/files/fr/web/api/geolocation/clearwatch/index.html b/files/fr/web/api/geolocation/clearwatch/index.html new file mode 100644 index 0000000000..b60b0df663 --- /dev/null +++ b/files/fr/web/api/geolocation/clearwatch/index.html @@ -0,0 +1,143 @@ +--- +title: Geolocation.clearWatch() +slug: Web/API/Geolocation/clearWatch +tags: + - API + - Besoin d'exemple + - Géolocalisation + - Géolocalisation API + - Méthode + - Reference +translation_of: Web/API/Geolocation/clearWatch +--- +

{{ APIref("Geolocation API") }}

+ +

La méthode Geolocation.clearWatch() est utilisée pour libérer les ressources de localisation/erreur créées antérieurement en utilisant {{domxref("Geolocation.watchPosition()")}}.

+ +

Syntaxe

+ +
navigator.geolocation.clearWatch(id);
+ +

Paramètres

+ +
+
id
+
Le nombre ID est donné par la méthode qui permet la localisation : {{domxref("Geolocation.watchPosition()")}} ; ressource que vous désirez supprimer.
+
+ +

Exemple

+ +
var id, target, option;
+
+function success(pos) {
+  var crd = pos.coords;
+
+  if (target.latitude === crd.latitude && target.longitude === crd.longitude) {
+    console.log('Congratulation, you reach the target');
+    navigator.geolocation.clearWatch(id);
+  }
+};
+
+function error(err) {
+  console.warn('ERROR(' + err.code + '): ' + err.message);
+};
+
+target = {
+  latitude : 0,
+  longitude: 0,
+}
+
+options = {
+  enableHighAccuracy: false,
+  timeout: 5000,
+  maximumAge: 0
+};
+
+id = navigator.geolocation.watchPosition(success, error, options);
+
+ +

Spécifications

+ + + + + + + + + + + + + + + + +
SpécificationStatutCommentaire
{{SpecName('Geolocation')}}{{Spec2('Geolocation')}}Spécification initiale.
+ +

Compatibilité des navigateurs

+ +

{{ CompatibilityTable() }}

+ +
+ + + + + + + + + + + + + + + + + + + + + +
CaractéristiqueChromeLimiteFirefox (Gecko)Internet ExplorerOperaSafari
Basic support5{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.9.1")}}910.60
+ Supprimé en 15.0
+ Réintroduite en 16.0
5
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
CaractéristiqueAndroidChrome pour AndroidEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown()}}{{CompatUnknown()}}{{CompatVersionUnknown}}{{CompatGeckoMobile("4")}}{{CompatUnknown()}}10.60{{CompatUnknown()}}
+
+ +

Voir également

+ + -- cgit v1.2.3-54-g00ecf