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 NetworkInformationProvider

Remarks

A provider can be shared by several browsing contexts, and used from any thread.

Constructors

NameDescription
NetworkInformationProvider()

NetworkInformationProvider()

NetworkInformation.cs
public NetworkInformationProvider()

No documentation is available.

Properties

NameDescription
StatusGets 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.

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.

public NetworkConnectionStatus Status { get; set; }

Methods

NameDescription
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.

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.

public virtual NetworkConnectionStatus GetStatus()

OnStatusChanged()

NetworkInformation.cs

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.

protected void OnStatusChanged()

Events

NameDescription
StatusChangedRaised when the status changes (NetworkInformationProvider.OnStatusChanged).

StatusChanged

Raised when the status changes (NetworkInformationProvider.OnStatusChanged).

public event EventHandler? StatusChanged