Skip to content

Commit

Permalink
Adapt NetworkInformation API to new events structure (#13887)
Browse files Browse the repository at this point in the history
This PR adapts the NetworkInformation API to conform to the new events structure.
  • Loading branch information
queengooborg authored Mar 16, 2022
1 parent 490f487 commit 5402863
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 28 deletions.
13 changes: 7 additions & 6 deletions files/en-us/_redirects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7517,10 +7517,10 @@
/en-US/docs/Web/API/Connection /en-US/docs/Web/API/NetworkInformation
/en-US/docs/Web/API/Connection.bandwidth /en-US/docs/Web/API/NetworkInformation
/en-US/docs/Web/API/Connection.metered /en-US/docs/Web/API/NetworkInformation
/en-US/docs/Web/API/Connection.onchange /en-US/docs/Web/API/NetworkInformation/onchange
/en-US/docs/Web/API/Connection.onchange /en-US/docs/Web/API/NetworkInformation/change_event
/en-US/docs/Web/API/Connection/bandwidth /en-US/docs/Web/API/NetworkInformation
/en-US/docs/Web/API/Connection/metered /en-US/docs/Web/API/NetworkInformation
/en-US/docs/Web/API/Connection/onchange /en-US/docs/Web/API/NetworkInformation/onchange
/en-US/docs/Web/API/Connection/onchange /en-US/docs/Web/API/NetworkInformation/change_event
/en-US/docs/Web/API/Console._exception /en-US/docs/Web/API/console/error
/en-US/docs/Web/API/Console.count /en-US/docs/Web/API/console/count
/en-US/docs/Web/API/Console.debug /en-US/docs/Web/API/console/log
Expand Down Expand Up @@ -8526,7 +8526,7 @@
/en-US/docs/Web/API/Navigator.connection /en-US/docs/Web/API/Navigator/connection
/en-US/docs/Web/API/Navigator.connection.bandwidth /en-US/docs/Web/API/NetworkInformation
/en-US/docs/Web/API/Navigator.connection.metered /en-US/docs/Web/API/NetworkInformation
/en-US/docs/Web/API/Navigator.connection.onchange /en-US/docs/Web/API/NetworkInformation/onchange
/en-US/docs/Web/API/Navigator.connection.onchange /en-US/docs/Web/API/NetworkInformation/change_event
/en-US/docs/Web/API/Navigator.cookieEnabled /en-US/docs/Web/API/Navigator/cookieEnabled
/en-US/docs/Web/API/Navigator.geolocation /en-US/docs/Web/API/Navigator/geolocation
/en-US/docs/Web/API/Navigator.getBattery /en-US/docs/Web/API/Navigator/getBattery
Expand Down Expand Up @@ -8594,10 +8594,11 @@
/en-US/docs/Web/API/NavigatorStorage /en-US/docs/Web/API/Navigator
/en-US/docs/Web/API/NavigatorStorage/storage /en-US/docs/Web/API/Navigator/storage
/en-US/docs/Web/API/NetworkInformation.connection /en-US/docs/Web/API/Navigator/connection
/en-US/docs/Web/API/NetworkInformation.ontypechange /en-US/docs/Web/API/NetworkInformation/onchange
/en-US/docs/Web/API/NetworkInformation.ontypechange /en-US/docs/Web/API/NetworkInformation/change_event
/en-US/docs/Web/API/NetworkInformation/NetworkInformation.rtt /en-US/docs/Web/API/NetworkInformation/rtt
/en-US/docs/Web/API/NetworkInformation/connection /en-US/docs/Web/API/Navigator/connection
/en-US/docs/Web/API/NetworkInformation/ontypechange /en-US/docs/Web/API/NetworkInformation/onchange
/en-US/docs/Web/API/NetworkInformation/onchange /en-US/docs/Web/API/NetworkInformation/change_event
/en-US/docs/Web/API/NetworkInformation/ontypechange /en-US/docs/Web/API/NetworkInformation/change_event
/en-US/docs/Web/API/Node.appendChild /en-US/docs/Web/API/Node/appendChild
/en-US/docs/Web/API/Node.attributes /en-US/docs/Web/API/Element/attributes
/en-US/docs/Web/API/Node.baseURI /en-US/docs/Web/API/Node/baseURI
Expand Down Expand Up @@ -10076,7 +10077,7 @@
/en-US/docs/Web/API/window.navigator.connection /en-US/docs/Web/API/Navigator/connection
/en-US/docs/Web/API/window.navigator.connection.bandwidth /en-US/docs/Web/API/NetworkInformation
/en-US/docs/Web/API/window.navigator.connection.metered /en-US/docs/Web/API/NetworkInformation
/en-US/docs/Web/API/window.navigator.connection.onchange /en-US/docs/Web/API/NetworkInformation/onchange
/en-US/docs/Web/API/window.navigator.connection.onchange /en-US/docs/Web/API/NetworkInformation/change_event
/en-US/docs/Web/API/window.navigator.cookieEnabled /en-US/docs/Web/API/Navigator/cookieEnabled
/en-US/docs/Web/API/window.navigator.geolocation /en-US/docs/Web/API/Navigator/geolocation
/en-US/docs/Web/API/window.navigator.geolocation.clearWatch /en-US/docs/Web/API/Geolocation/clearWatch
Expand Down
20 changes: 10 additions & 10 deletions files/en-us/_wikihistory.json
Original file line number Diff line number Diff line change
Expand Up @@ -62027,6 +62027,16 @@
"Sebastianz"
]
},
"Web/API/NetworkInformation/change_event": {
"modified": "2020-10-15T21:39:13.773Z",
"contributors": [
"fscholz",
"jpmedley",
"chrisdavidmills",
"YuichiNukiyama",
"teoli"
]
},
"Web/API/NetworkInformation/downlink": {
"modified": "2020-10-15T21:56:55.792Z",
"contributors": [
Expand Down Expand Up @@ -62054,16 +62064,6 @@
"diaboltron"
]
},
"Web/API/NetworkInformation/onchange": {
"modified": "2020-10-15T21:39:13.773Z",
"contributors": [
"fscholz",
"jpmedley",
"chrisdavidmills",
"YuichiNukiyama",
"teoli"
]
},
"Web/API/NetworkInformation/rtt": {
"modified": "2020-10-15T21:57:57.785Z",
"contributors": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
---
title: NetworkInformation.onchange
slug: Web/API/NetworkInformation/onchange
title: 'NetworkInformation: change event'
slug: Web/API/NetworkInformation/change_event
tags:
- API
- Event Handler
- Experimental
- Network Information API
- NetworkInformation
- Property
- Event
- Reference
browser-compat: api.NetworkInformation.onchange
browser-compat: api.NetworkInformation.change_event
---
{{apiref("Network Information API")}}{{SeeCompatTable}}

The **`NetworkInformation.onchange`** event handler contains
the code that is fired when connection information changes, and the {{event("change")}}
The **`change`** event fires when connection information changes, and the {{event("change")}}
is received by the {{domxref("NetworkInformation")}} object.

## Syntax

Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.

```js
netInfo.onchange = function() { /* ... */ }
addEventListener('change', event => { });

onchange = event => { };
```

## Event type

A generic {{domxref("Event")}}.

## Examples

```js
Expand Down
10 changes: 5 additions & 5 deletions files/en-us/web/api/networkinformation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ _This interface also inherits properties of its parent, {{domxref("EventTarget")
- `other`
- `unknown`

### Event handlers

- {{domxref("NetworkInformation.onchange")}}
- : The event that's fired when connection information changes and the {{event("change")}} is fired on this object.

## Methods

_This interface also inherits methods of its parent, {{domxref("EventTarget")}}._

## Events

- {{domxref("NetworkInformation.change_event", "change")}}
- : The event that's fired when connection information changes.

## Specifications

{{Specifications}}
Expand Down

0 comments on commit 5402863

Please sign in to comment.