DeviceRequestPrompt
Namespace: PuppeteerSharp
[SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Listener subscriptions are disposed in SelectAsync/CancelAsync via DisposableActionsStack.")]public class DeviceRequestPromptDevice request prompts let you respond to the page requesting for a device through an API like WebBluetooth.
Inheritance: object
DeviceRequestPrompt instances are returned via the WaitForDevicePromptAsync(WaitForOptions).
Example
Properties
Section titled “Properties”Devices
Section titled “Devices”public List<DeviceRequestPromptDevice> Devices { get; }Current list of selectable devices.
Value: List<DeviceRequestPromptDevice>
Methods
Section titled “Methods”CancelAsync()
Section titled “CancelAsync()”public Task CancelAsync()Cancel the prompt.
Returns: Task — A task that resolves after the cancel message is processed by the browser.
SelectAsync(DeviceRequestPromptDevice)
Section titled “SelectAsync(DeviceRequestPromptDevice)”public Task SelectAsync(DeviceRequestPromptDevice device)Select a device in the prompt’s list.
Parameters
| Name | Type | Description |
|---|---|---|
device |
DeviceRequestPromptDevice | The device to select. |
Returns: Task — A task that resolves after the select message is processed by the browser.
WaitForDeviceAsync(Func<DeviceRequestPromptDevice, bool>, WaitForOptions)
Section titled “WaitForDeviceAsync(Func<DeviceRequestPromptDevice, bool>, WaitForOptions)”public Task<DeviceRequestPromptDevice> WaitForDeviceAsync(Func<DeviceRequestPromptDevice, bool> filter, WaitForOptions options = null)Resolve to the first device in the prompt matching a filter.
Parameters
| Name | Type | Description |
|---|---|---|
filter |
Func<DeviceRequestPromptDevice, bool> | The filter to apply. |
options |
WaitForOptions | The options. |
Returns: Task<DeviceRequestPromptDevice> — A task that resolves to the first device matching the filter.
Made with love by Dario Kondratiuk