Skip to content

DeviceRequestPrompt

Namespace: PuppeteerSharp

[SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Listener subscriptions are disposed in SelectAsync/CancelAsync via DisposableActionsStack.")]
public class DeviceRequestPrompt

Device 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

View source

public List<DeviceRequestPromptDevice> Devices { get; }

Current list of selectable devices.

Value: List<DeviceRequestPromptDevice>

View source

public Task CancelAsync()

Cancel the prompt.

Returns: Task — A task that resolves after the cancel message is processed by the browser.

View source

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.

View source

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.

View source

Made with love by Dario Kondratiuk