Skip to content

Adjust Bluetooth IDL for Rust #2385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions crates/web-sys/src/features/gen_Bluetooth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,6 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn get_devices(this: &Bluetooth) -> ::js_sys::Promise;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "Bluetooth" , js_name = requestDevice)]
#[doc = "The `requestDevice()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/requestDevice)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn request_device(this: &Bluetooth) -> ::js_sys::Promise;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "RequestDeviceOptions")]
# [wasm_bindgen (method , structural , js_class = "Bluetooth" , js_name = requestDevice)]
#[doc = "The `requestDevice()` method."]
Expand All @@ -225,8 +214,5 @@ extern "C" {
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn request_device_with_options(
this: &Bluetooth,
options: &RequestDeviceOptions,
) -> ::js_sys::Promise;
pub fn request_device(this: &Bluetooth, options: &RequestDeviceOptions) -> ::js_sys::Promise;
}
2 changes: 1 addition & 1 deletion crates/web-sys/src/features/gen_Navigator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ extern "C" {
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn bluetooth(this: &Navigator) -> Bluetooth;
pub fn bluetooth(this: &Navigator) -> Option<Bluetooth>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "Clipboard")]
# [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = clipboard)]
Expand Down
6 changes: 3 additions & 3 deletions crates/web-sys/webidls/unstable/Bluetooth.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface Bluetooth : EventTarget {
[SameObject]
readonly attribute BluetoothDevice? referringDevice;
Promise<sequence<BluetoothDevice>> getDevices();
Promise<BluetoothDevice> requestDevice(optional RequestDeviceOptions options = {});
Promise<BluetoothDevice> requestDevice(RequestDeviceOptions options);
};

Bluetooth includes BluetoothDeviceEventHandlers;
Expand Down Expand Up @@ -232,5 +232,5 @@ typedef (DOMString or unsigned long) BluetoothDescriptorUUID;
[SecureContext]
partial interface Navigator {
[SameObject]
readonly attribute Bluetooth bluetooth;
};
readonly attribute Bluetooth? bluetooth;
};