DevicePostureProvider Class

The source of the posture of the device (https://w3c.github.io/device-posture/#dfn-calculate-the-device-posture-information), read by the documents of the browsing contexts that share a BrowsingContextOptions (DevicePostureOptions.Provider). The default implementation returns DevicePostureProvider.Posture, set by the application. Override DevicePostureProvider.GetPosture to read another source, and call DevicePostureProvider.OnPostureChanged when the posture changes, to update the documents.

public class DevicePostureProvider

Remarks

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

Constructors

NameDescription
DevicePostureProvider()

DevicePostureProvider()

DevicePosture.cs
public DevicePostureProvider()

No documentation is available.

Properties

NameDescription
PostureGets or sets the posture returned by the default implementation of DevicePostureProvider.GetPosture (DevicePostureType.Continuous by default). Setting it updates the documents: the DevicePosture objects of the visible documents fire their change events, and the media queries are evaluated again.

Gets or sets the posture returned by the default implementation of DevicePostureProvider.GetPosture (DevicePostureType.Continuous by default). Setting it updates the documents: the DevicePosture objects of the visible documents fire their change events, and the media queries are evaluated again.

public DevicePostureType Posture { get; set; }

Property value

DevicePostureType

Methods

NameDescription
GetPosture()Returns the posture of the device. The default implementation returns DevicePostureProvider.Posture. It is called on the thread of an event loop, and must not block it.
OnPostureChanged()Raises DevicePostureProvider.PostureChanged, then runs the device posture change steps (https://w3c.github.io/device-posture/#dfn-device-posture-change-steps) for the documents, and evaluates their media queries again. It can be called from any thread.

GetPosture()

DevicePosture.cs

Returns the posture of the device. The default implementation returns DevicePostureProvider.Posture. It is called on the thread of an event loop, and must not block it.

public virtual DevicePostureType GetPosture()

OnPostureChanged()

DevicePosture.cs

Raises DevicePostureProvider.PostureChanged, then runs the device posture change steps (https://w3c.github.io/device-posture/#dfn-device-posture-change-steps) for the documents, and evaluates their media queries again. It can be called from any thread.

protected void OnPostureChanged()

Events

NameDescription
PostureChangedRaised when the posture changes (DevicePostureProvider.OnPostureChanged).

PostureChanged

Raised when the posture changes (DevicePostureProvider.OnPostureChanged).

public event EventHandler? PostureChanged