aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/api/geolocation/watchposition
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:45 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:45 -0500
commit1109132f09d75da9a28b649c7677bb6ce07c40c0 (patch)
tree0dd8b084480983cf9f9680e8aedb92782a921b13 /files/es/web/api/geolocation/watchposition
parent4b1a9203c547c019fc5398082ae19a3f3d4c3efe (diff)
downloadtranslated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.tar.gz
translated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.tar.bz2
translated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.zip
initial commit
Diffstat (limited to 'files/es/web/api/geolocation/watchposition')
-rw-r--r--files/es/web/api/geolocation/watchposition/index.html138
1 files changed, 138 insertions, 0 deletions
diff --git a/files/es/web/api/geolocation/watchposition/index.html b/files/es/web/api/geolocation/watchposition/index.html
new file mode 100644
index 0000000000..dbd6a1170d
--- /dev/null
+++ b/files/es/web/api/geolocation/watchposition/index.html
@@ -0,0 +1,138 @@
+---
+title: Geolocation.watchPosition()
+slug: Web/API/Geolocation/watchPosition
+translation_of: Web/API/Geolocation/watchPosition
+---
+<p>{{ APIref("Geolocation API") }}</p>
+
+<p><span id="result_box" lang="es"><span class="hps">El método</span> <strong><code>Geolocation.watchPosition()</code></strong> <span class="hps">se utiliza para registrar</span> <span class="hps">una función de controlador</span> <span class="hps">que se llamará</span> <span class="hps">automáticamente cada vez que</span> <span class="hps">la posición</span> <span class="hps">del dispositivo cambia</span><span>.</span> <span class="hps">También puede</span><span>,</span> <span class="hps">opcionalmente</span><span>,</span> <span class="hps">especificar una</span> <span class="hps">función de devolución de</span> <span class="hps">la gestión de errores</span><span>.</span></span></p>
+
+<p><span id="result_box" lang="es"><span class="hps">Este método devuelve un</span> <span class="hps">valor de ID de</span> <span class="hps">seguimiento</span> <span class="hps">que</span> <span class="hps">se puede utilizar para</span> <span class="hps">anular el registro del</span> <span class="hps">controlador</span> <span class="hps">pasándolo</span> <span class="hps">al método</span> </span><a href="/es/docs/Web/API/Geolocation.clearWatch">Geolocation.clearWatch()</a>.</p>
+
+<h2 id="Sintaxis">Sintaxis</h2>
+
+<pre class="syntaxbox"><em>id</em> = navigator.geolocation.watchPosition(<em>success</em>, <em>error</em>, <em>options</em>)</pre>
+
+<h3 id="Parámetros">Parámetros</h3>
+
+<dl>
+ <dt><em>success</em></dt>
+ <dd><span id="result_box" lang="es"><span class="hps">Una función de</span> <span class="hps">devolución de llamada que</span> <span class="hps">toma un objeto</span> <span class="hps">de posición</span>({{domxref("Position")}}) <span class="hps">como parámetro de entrada</span><span>.</span></span></dd>
+ <dt><em>error</em> {{optional_inline}}</dt>
+ <dd><span id="result_box" lang="es"><span class="hps">Una función</span> <span class="hps">de devolución de llamada</span> <span class="hps">opcional que</span> <span class="hps">toma un objeto</span> {{domxref("PositionError")}} <span class="hps">como parámetro de entrada</span><span>.</span></span></dd>
+ <dt><em>options</em> {{optional_inline}}</dt>
+ <dd>Un objeto opcional {{domxref("PositionOptions")}}.</dd>
+</dl>
+
+<h2 id="Ejemplo">Ejemplo</h2>
+
+<pre class="brush: js">var id, target, option;
+
+function success(pos) {
+ var crd = pos.coords;
+
+ if (target.latitude === crd.latitude &amp;&amp; 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);
+</pre>
+
+<h2 id="Especificacines">Especificacines</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Especificación</th>
+ <th scope="col">Estado</th>
+ <th scope="col">Comentario</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('Geolocation', '#watch-position', 'Geolocation.watchPosition()')}}</td>
+ <td>{{Spec2('Geolocation')}}</td>
+ <td>Especificación inicial</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilidad_de_navegador">Compatibilidad de navegador</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Característica</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Soporte básico</td>
+ <td>5</td>
+ <td>{{CompatGeckoDesktop("1.9.1")}}</td>
+ <td>9</td>
+ <td>10.60<br>
+ Eliminado en 15.0<br>
+ Reintroducido en 16.0</td>
+ <td>5</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Característica</th>
+ <th>Android</th>
+ <th>Chrome para Android</th>
+ <th>Firefox Mobil (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobil</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Soporte básico</td>
+ <td>{{CompatUnknown()}}</td>
+ <td>{{CompatUnknown()}}</td>
+ <td>{{CompatGeckoMobile("4")}}</td>
+ <td>{{CompatUnknown()}}</td>
+ <td>10.60</td>
+ <td>{{CompatUnknown()}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="Ver_también">Ver también</h2>
+
+<ul>
+ <li><a href="/es/docs/Usar_la_Geolocalizaci%C3%B3n">Uso de la geolocalización</a></li>
+ <li><a href="/es/docs/Web/API/Geolocalizaci%C3%B3n">Geolocalización</a>.</li>
+ <li><a href="/es/docs/Web/API/Geolocation.clearWatch">Geolocation.clearWatch()</a></li>
+ <li><a href="/es/docs/Web/API/Geolocation.getCurrentPosition">Geolocation.getCurrentPosition()</a></li>
+</ul>