From 1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde Mon Sep 17 00:00:00 2001 From: julieng Date: Sat, 2 Oct 2021 17:20:24 +0200 Subject: convert content to md --- files/fr/web/api/geolocation/clearwatch/index.md | 74 +++++++---------- .../api/geolocation/getcurrentposition/index.md | 87 ++++++++------------ files/fr/web/api/geolocation/index.md | 63 ++++++--------- .../fr/web/api/geolocation/watchposition/index.md | 92 +++++++++------------- 4 files changed, 123 insertions(+), 193 deletions(-) (limited to 'files/fr/web/api/geolocation') diff --git a/files/fr/web/api/geolocation/clearwatch/index.md b/files/fr/web/api/geolocation/clearwatch/index.md index c4952eb7cf..e3cf88e859 100644 --- a/files/fr/web/api/geolocation/clearwatch/index.md +++ b/files/fr/web/api/geolocation/clearwatch/index.md @@ -10,29 +10,28 @@ tags: - Reference translation_of: Web/API/Geolocation/clearWatch --- -

{{ APIref("Geolocation API") }}

+{{ 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()")}}.

+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

+## Syntaxe -
navigator.geolocation.clearWatch(id);
+ navigator.geolocation.clearWatch(id); -

Paramètres

+### 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.
-
+- _id_ + - : Le nombre ID est donné par la méthode qui permet la localisation : {{domxref("Geolocation.watchPosition()")}} ; ressource que vous désirez supprimer. -

Exemple

+## Exemple -
var id, target, option;
+```js
+var id, target, option;
 
 function success(pos) {
   var crd = pos.coords;
 
-  if (target.latitude === crd.latitude && target.longitude === crd.longitude) {
+  if (target.latitude === crd.latitude && target.longitude === crd.longitude) {
     console.log('Congratulation, you reach the target');
     navigator.geolocation.clearWatch(id);
   }
@@ -54,36 +53,21 @@ options = {
 };
 
 id = navigator.geolocation.watchPosition(success, error, options);
-
- -

Spécifications

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

Compatibilité des navigateurs

- -

{{Compat("api.Geolocation.clearWatch")}}

- -

Voir aussi

- - +``` + +## Spécifications + +| Spécification | Statut | Commentaire | +| ------------------------------------ | -------------------------------- | ----------------------- | +| {{SpecName('Geolocation')}} | {{Spec2('Geolocation')}} | Spécification initiale. | + +## Compatibilité des navigateurs + +{{Compat("api.Geolocation.clearWatch")}} + +## Voir aussi + +- [Utiliser geolocation](/fr/docs/Web/API/Using_geolocation) +- {{domxref("Geolocation")}} +- {{domxref("Geolocation.watchPosition()")}} +- {{domxref("Geolocation.getCurrentPosition()")}} diff --git a/files/fr/web/api/geolocation/getcurrentposition/index.md b/files/fr/web/api/geolocation/getcurrentposition/index.md index 8168640a6c..a2d19748da 100644 --- a/files/fr/web/api/geolocation/getcurrentposition/index.md +++ b/files/fr/web/api/geolocation/getcurrentposition/index.md @@ -8,34 +8,32 @@ tags: - Reference translation_of: Web/API/Geolocation/getCurrentPosition --- -
{{securecontext_header}}{{APIRef("Geolocation API")}}
+{{securecontext_header}}{{APIRef("Geolocation API")}} -

La méthode Geolocation.getCurrentPosition() fournit la position actuelle de l'appareil.

+La méthode **`Geolocation.getCurrentPosition()`** fournit la position actuelle de l'appareil. -

Syntaxe

+## Syntaxe -
navigator.geolocation.getCurrentPosition(success[, error[, [options]])
+ navigator.geolocation.getCurrentPosition(success[, error[, [options]]) -

Paramètres

+### Paramètres -
-
success
-
Une fonction de rappel qui prend un objet {{domxref("Position")}} comme argument.
-
error {{optional_inline}}
-
Une fonction de rappel qui prend un objet {{domxref("PositionError")}} comme argument.
-
options {{optional_inline}}
-
Un objet {{domxref("PositionOptions")}} optionnel. Les options décrites par cet objet sont : -
    -
  • maximumAge : un entier qui exprime une durée en millisecondes ou l'infini pour indiquer la durée maximale pendant laquelle mettre en cache la position.
  • -
  • timeout : un entier qui exprime la durée, en millisecondes, avant que la fonction de rappel error soit appelé. Si cette propriété vaut 0, la fonction d'erreur ne sera jamais appelée.
  • -
  • enableHighAccuracy : un booléen qui indique si une précision élevée est requise.
  • -
-
-
+- `success` + - : Une fonction de rappel qui prend un objet {{domxref("Position")}} comme argument. +- `error` {{optional_inline}} + - : Une fonction de rappel qui prend un objet {{domxref("PositionError")}} comme argument. +- `options` {{optional_inline}} -

Exemples

+ - : Un objet {{domxref("PositionOptions")}} optionnel. Les options décrites par cet objet sont : -
var options = {
+    - `maximumAge` : un entier qui exprime une durée en millisecondes ou l'infini pour indiquer la durée maximale pendant laquelle mettre en cache la position.
+    - `timeout` : un entier qui exprime la durée, en millisecondes, avant que la fonction de rappel `error` soit appelé. Si cette propriété vaut `0`, la fonction d'erreur ne sera jamais appelée.
+    - `enableHighAccuracy` : un booléen qui indique si une précision élevée est requise.
+
+## Exemples
+
+```js
+var options = {
   enableHighAccuracy: true,
   timeout: 5000,
   maximumAge: 0
@@ -55,34 +53,19 @@ function error(err) {
 }
 
 navigator.geolocation.getCurrentPosition(success, error, options);
-
- -

Spécifications

- - - - - - - - - - - - - - - - -
SpécificationÉtatCommentaires
{{SpecName('Geolocation')}}{{Spec2('Geolocation')}}Spécification initiale.
- -

Compatibilité des navigateurs

- -

{{Compat("api.Geolocation.getCurrentPosition")}}

- -

Voir aussi

- - +``` + +## Spécifications + +| Spécification | État | Commentaires | +| ------------------------------------ | -------------------------------- | ----------------------- | +| {{SpecName('Geolocation')}} | {{Spec2('Geolocation')}} | Spécification initiale. | + +## Compatibilité des navigateurs + +{{Compat("api.Geolocation.getCurrentPosition")}} + +## Voir aussi + +- [Utiliser la géolocalisation](/en-US/docs/WebAPI/Using_geolocation) +- {{domxref("Navigator.geolocation")}} diff --git a/files/fr/web/api/geolocation/index.md b/files/fr/web/api/geolocation/index.md index e492a2a532..035dbab103 100644 --- a/files/fr/web/api/geolocation/index.md +++ b/files/fr/web/api/geolocation/index.md @@ -9,58 +9,39 @@ tags: - Reference translation_of: Web/API/Geolocation --- -
{{APIRef("Geolocation API")}}
+{{APIRef("Geolocation API")}} -

En intégrant l'interface Geolocation, on peut obtenir la position d'un ordinateur, d'un téléphone ou d'une tablette, ce qui permet aux contenus Web d'accéder à leur localisation. Un site internet ou une application mobile peut alors offrir divers services liés à la localisation de l'utilisateur.

+En intégrant l'interface **`Geolocation`**, on peut obtenir la position d'un ordinateur, d'un téléphone ou d'une tablette, ce qui permet aux contenus Web d'accéder à leur localisation. Un site internet ou une application mobile peut alors offrir divers services liés à la localisation de l'utilisateur. -

On obtient un objet par le biais de cette interface avec la propriété {{domxref("NavigatorGeolocation.geolocation")}} proposée par l'objet {{domxref("Navigator")}} .

+On obtient un objet par le biais de cette interface avec la propriété {{domxref("NavigatorGeolocation.geolocation")}} proposée par l'objet {{domxref("Navigator")}} . -
-

Note: Pour des raisons de sécurité, quand une page web tente d'accéder aux données de localisation, l'utilisateur est prévenu, et son accord lui est demandé. Sachez que chaque navigateur a ses propres méthodes et politiques pour gérer les autorisations.

-
+> **Note :** Pour des raisons de sécurité, quand une page web tente d'accéder aux données de localisation, l'utilisateur est prévenu, et son accord lui est demandé. Sachez que chaque navigateur a ses propres méthodes et politiques pour gérer les autorisations. -

Propriétés

+## Propriétés -

L'interface de géolocalisation n'utilise ou n'hérite d'aucune propriété.

+_L'interface de géolocalisation n'utilise ou n'hérite d'aucune propriété._ -

Méthodes

+## Méthodes -

L'interface de géolocalisation n'hérite d'aucune méthode.

+_L'interface de géolocalisation n'hérite d'aucune méthode._ -
-
{{domxref("Geolocation.getCurrentPosition()")}}
-
Determine la position actuelle de l'appareil et donne en retour l'objet {{domxref("Position")}} avec sa valeur.
-
{{domxref("Geolocation.watchPosition()")}}
-
Retourne une valeur long représentant la nouvelle fonction callback, créée pour être utilisée à chaque fois que la position de l'appareil change.
-
{{domxref("Geolocation.clearWatch()")}}
-
Supprime le lien créé par la précédente utilisation de watchPosition().
-
+- {{domxref("Geolocation.getCurrentPosition()")}} + - : Determine la position actuelle de l'appareil et donne en retour l'objet {{domxref("Position")}} avec sa valeur. +- {{domxref("Geolocation.watchPosition()")}} + - : Retourne une valeur `long` représentant la nouvelle fonction callback, créée pour être utilisée à chaque fois que la position de l'appareil change. +- {{domxref("Geolocation.clearWatch()")}} + - : Supprime le lien créé par la précédente utilisation de `watchPosition()`. -

Spécifications

+## Spécifications - - - - - - - - - - - - - - - -
SpécificationStatutCommentaire
{{SpecName('Geolocation')}}{{Spec2('Geolocation')}}Spécification initiale.
+| Spécification | Statut | Commentaire | +| ------------------------------------ | -------------------------------- | ----------------------- | +| {{SpecName('Geolocation')}} | {{Spec2('Geolocation')}} | Spécification initiale. | -

Compatibilité des navigateurs

+## Compatibilité des navigateurs -

{{Compat("api.Geolocation")}}

+{{Compat("api.Geolocation")}} -

Voir aussi

+## Voir aussi - +- [Utiliser geolocation](/fr/docs/Web/API/Geolocation_API/Using_the_Geolocation_API) diff --git a/files/fr/web/api/geolocation/watchposition/index.md b/files/fr/web/api/geolocation/watchposition/index.md index c2424f4774..71ed0cfc2c 100644 --- a/files/fr/web/api/geolocation/watchposition/index.md +++ b/files/fr/web/api/geolocation/watchposition/index.md @@ -10,35 +10,34 @@ tags: - Reference translation_of: Web/API/Geolocation/watchPosition --- -

{{ APIref("Geolocation API") }}

+{{ APIref("Geolocation API") }} -

La méthode Geolocation.watchPosition() permet de manipuler une fonction appelée automatiquement à chaque fois que la position de l'appareil change. Vous pouvez de même, en option, manipuler une autre fonction appelée automatiquement pour gérer les erreurs.

+La méthode **`Geolocation.watchPosition()`** permet de manipuler une fonction appelée automatiquement à chaque fois que la position de l'appareil change. Vous pouvez de même, en option, manipuler une autre fonction appelée automatiquement pour gérer les erreurs. -

Cette méthode retourne une valeur ID de veille qui permet de libérer les fonctions déclarées automatiquement, évoquées précédemment, à l'aide de la méthode {{domxref("Geolocation.clearWatch()")}}.

+Cette méthode retourne une valeur ID de veille qui permet de libérer les fonctions déclarées automatiquement, évoquées précédemment, à l'aide de la méthode {{domxref("Geolocation.clearWatch()")}}. -

Syntaxe

+## Syntaxe -
id = navigator.geolocation.watchPosition(success[, error[, options]])
+ id = navigator.geolocation.watchPosition(success[, error[, options]]) -

Paramètres

+### Paramètres -
-
success
-
Nom d'une fonction appelée qui a pour paramètre l'objet {{domxref("Position")}}.
-
error {{optional_inline}}
-
Nom d'une fonction optionnelle qui a pour paramètre l'objet {{domxref("PositionError")}}.
-
options {{optional_inline}}
-
Un objet optionnel {{domxref("PositionOptions")}}.
-
+- _success_ + - : Nom d'une fonction appelée qui a pour paramètre l'objet {{domxref("Position")}}. +- _error_ {{optional_inline}} + - : Nom d'une fonction optionnelle qui a pour paramètre l'objet {{domxref("PositionError")}}. +- _options_ {{optional_inline}} + - : Un objet optionnel {{domxref("PositionOptions")}}. -

Exemple

+## Exemple -
var id, target, options;
+```js
+var id, target, options;
 
 function success(pos) {
   var crd = pos.coords;
 
-  if (target.latitude === crd.latitude && target.longitude === crd.longitude) {
+  if (target.latitude === crd.latitude && target.longitude === crd.longitude) {
     console.log('Bravo, vous avez atteint la cible');
     navigator.geolocation.clearWatch(id);
   }
@@ -60,41 +59,24 @@ options = {
 };
 
 id = navigator.geolocation.watchPosition(success, error, options);
-
- -
-

Note : Si votre application fonctionne sous Firefox OS, veillez à la geolocation wake lock pour que votre application continue à recevoir les changements de positions si votre application tourne en tâche de fond, ou si votre écran est éteint.

-
- -

Spécifications

- - - - - - - - - - - - - - - - -
SpécificationStatutCommentaire
{{SpecName('Geolocation', '#watch-position', 'Geolocation.watchPosition()')}}{{Spec2('Geolocation')}}Specification initiale.
- -

Compatibilité des navigateurs

- -

{{Compat("api.Geolocation.watchPosition")}}

- -

Voir aussi

- - +``` + +> **Note :** Si votre application fonctionne sous Firefox OS, veillez à la [geolocation wake lock]() pour que votre application continue à recevoir les changements de positions si votre application tourne en tâche de fond, ou si votre écran est éteint. + +## Spécifications + +| Spécification | Statut | Commentaire | +| -------------------------------------------------------------------------------------------------------- | -------------------------------- | ----------------------- | +| {{SpecName('Geolocation', '#watch-position', 'Geolocation.watchPosition()')}} | {{Spec2('Geolocation')}} | Specification initiale. | + +## Compatibilité des navigateurs + +{{Compat("api.Geolocation.watchPosition")}} + +## Voir aussi + +- [geolocation wake lock]() +- [Utiliser geolocation](/fr/docs/WebAPI/Using_geolocation) +- L'interface qui lui est réservée, {{domxref("Geolocation")}}, et la façon d'y accéder {{domxref("NavigatorGeolocation.geolocation")}}. +- L'opération inverse : {{domxref("Geolocation.clearWatch()")}} +- Une méthode similaire : {{domxref("Geolocation.getCurrentPosition()")}} -- cgit v1.2.3-54-g00ecf