-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add translation online_event to [es]
- Loading branch information
1 parent
c1295f6
commit 8d4cc8f
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
title: "Window: evento online" | ||
slug: Web/API/Window/online_event | ||
--- | ||
|
||
{{APIRef}} | ||
|
||
El evento **`online`** de la interface {{domxref("Window")}} se activa cuando el navegador ha obtenido acceso a la red y el valor de {{domxref("Navigator.onLine")}} cambia a `true`. | ||
|
||
> **Nota:** Este evento no debe usarse para determinar la disponibilidad de un sitio web en particular. Los problemas de red o cortafuegos aun pueden impedir que se acceda al sitio web. | ||
## Sintaxis | ||
|
||
Usa el nombre del evento en métodos como {{domxref("EventTarget.addEventListener", "addEventListener()")}}, o establecer una propiedad de controlador de eventos. | ||
|
||
```js | ||
addEventListener("online", (event) => {}); | ||
ononline = (event) => {}; | ||
``` | ||
|
||
## Tipo de evento | ||
|
||
Un {{domxref("Event", "Evento")}} genérico. | ||
|
||
## Alias del controlador de eventos | ||
|
||
Además de la interface `Window`, la propiedad de controlador de eventos `ononline` está disponible en los siguientes destinos. | ||
|
||
- {{domxref("HTMLBodyElement")}} | ||
- {{domxref("HTMLFrameSetElement")}} | ||
- {{domxref("SVGSVGElement")}} | ||
|
||
## Ejemplos | ||
|
||
```js | ||
// addEventListener version | ||
window.addEventListener("online", (event) => { | ||
console.log("Estas conectado a la red."); | ||
}); | ||
|
||
// ononline version | ||
window.ononline = (event) => { | ||
console.log("Estas conectado a la red."); | ||
}; | ||
``` | ||
|
||
## Especificacioness | ||
|
||
{{Specifications}} | ||
|
||
## Compatibilidad con navegadores | ||
|
||
{{Compat}} | ||
|
||
## Véase también | ||
|
||
- [`offline`](/es/docs/Web/API/Window/offline_event) | ||
|