NetworkInformationProvider Class
The source of the information about the network connection of the device (https://wicg.github.io/netinfo/), read by navigator.connection, of the browsing contexts that share a BrowsingContextOptions (NetworkInformationOptions.Provider). The default implementation returns NetworkInformationProvider.Status, set by the application (e.g. to simulate a slow network). Override NetworkInformationProvider.GetStatus to read another source, and call NetworkInformationProvider.OnStatusChanged when the connection changes, to update the NetworkInformation objects of the documents and of the workers.
public class NetworkInformationProviderRemarks
A provider can be shared by several browsing contexts, and used from any thread.
Constructors
| Name | Description |
|---|---|
| NetworkInformationProvider() |
NetworkInformationProvider()
NetworkInformation.cspublic NetworkInformationProvider()No documentation is available.
Properties
| Name | Description |
|---|---|
| Status | Gets or sets the status returned by the default implementation of NetworkInformationProvider.GetStatus (NetworkConnectionStatus.Default by default). Setting it updates the NetworkInformation objects, which fire their change event. |
Status
NetworkInformation.csGets or sets the status returned by the default implementation of NetworkInformationProvider.GetStatus (NetworkConnectionStatus.Default by default). Setting it updates the NetworkInformation objects, which fire their change event.
public NetworkConnectionStatus Status { get; set; }Property value
Methods
| Name | Description |
|---|---|
| GetStatus() | Returns the status of the connection. The default implementation returns NetworkInformationProvider.Status. It is called on the thread of an event loop, and must not block it. |
| OnStatusChanged() | Raises NetworkInformationProvider.StatusChanged, then reads the status again for the NetworkInformation objects, which fire their change event when a value they expose changed. It can be called from any thread. |
GetStatus()
NetworkInformation.csReturns the status of the connection. The default implementation returns NetworkInformationProvider.Status. It is called on the thread of an event loop, and must not block it.
public virtual NetworkConnectionStatus GetStatus()Returns
OnStatusChanged()
NetworkInformation.csRaises NetworkInformationProvider.StatusChanged, then reads the status again for the NetworkInformation objects, which fire their change event when a value they expose changed. It can be called from any thread.
protected void OnStatusChanged()Events
| Name | Description |
|---|---|
| StatusChanged | Raised when the status changes (NetworkInformationProvider.OnStatusChanged). |
StatusChanged
Raised when the status changes (NetworkInformationProvider.OnStatusChanged).
public event EventHandler? StatusChanged