forked from rustwasm/wasm-bindgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add WebIDLs for experimental AudioContext sinkId, setSinkId (rustwasm…
- Loading branch information
1 parent
ed9e03b
commit c9680a8
Showing
12 changed files
with
269 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
crates/web-sys/src/features/gen_AudioContextLatencyCategory.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#![allow(unused_imports)] | ||
#![allow(clippy::all)] | ||
use wasm_bindgen::prelude::*; | ||
#[wasm_bindgen] | ||
#[doc = "The `AudioContextLatencyCategory` enum."] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `AudioContextLatencyCategory`*"] | ||
#[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
pub enum AudioContextLatencyCategory { | ||
Balanced = "balanced", | ||
Interactive = "interactive", | ||
Playback = "playback", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#![allow(unused_imports)] | ||
#![allow(clippy::all)] | ||
use super::*; | ||
use wasm_bindgen::prelude::*; | ||
#[cfg(web_sys_unstable_apis)] | ||
#[wasm_bindgen] | ||
extern "C" { | ||
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = AudioSinkInfo , typescript_type = "AudioSinkInfo")] | ||
#[derive(Debug, Clone, PartialEq, Eq)] | ||
#[doc = "The `AudioSinkInfo` class."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioSinkInfo)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `AudioSinkInfo`*"] | ||
#[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 type AudioSinkInfo; | ||
#[cfg(web_sys_unstable_apis)] | ||
#[cfg(feature = "AudioSinkType")] | ||
# [wasm_bindgen (structural , method , getter , js_class = "AudioSinkInfo" , js_name = type)] | ||
#[doc = "Getter for the `type` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioSinkInfo/type)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `AudioSinkInfo`, `AudioSinkType`*"] | ||
#[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 type_(this: &AudioSinkInfo) -> AudioSinkType; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#![allow(unused_imports)] | ||
#![allow(clippy::all)] | ||
use super::*; | ||
use wasm_bindgen::prelude::*; | ||
#[cfg(web_sys_unstable_apis)] | ||
#[wasm_bindgen] | ||
extern "C" { | ||
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = AudioSinkOptions)] | ||
#[derive(Debug, Clone, PartialEq, Eq)] | ||
#[doc = "The `AudioSinkOptions` dictionary."] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `AudioSinkOptions`*"] | ||
#[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 type AudioSinkOptions; | ||
} | ||
#[cfg(web_sys_unstable_apis)] | ||
impl AudioSinkOptions { | ||
#[cfg(feature = "AudioSinkType")] | ||
#[doc = "Construct a new `AudioSinkOptions`."] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `AudioSinkOptions`, `AudioSinkType`*"] | ||
#[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 new(type_: AudioSinkType) -> Self { | ||
#[allow(unused_mut)] | ||
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); | ||
ret.type_(type_); | ||
ret | ||
} | ||
#[cfg(web_sys_unstable_apis)] | ||
#[cfg(feature = "AudioSinkType")] | ||
#[doc = "Change the `type` field of this object."] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `AudioSinkOptions`, `AudioSinkType`*"] | ||
#[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 type_(&mut self, val: AudioSinkType) -> &mut Self { | ||
use wasm_bindgen::JsValue; | ||
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); | ||
debug_assert!( | ||
r.is_ok(), | ||
"setting properties should never fail on our dictionary objects" | ||
); | ||
let _ = r; | ||
self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#![allow(unused_imports)] | ||
#![allow(clippy::all)] | ||
use wasm_bindgen::prelude::*; | ||
#[cfg(web_sys_unstable_apis)] | ||
#[wasm_bindgen] | ||
#[doc = "The `AudioSinkType` enum."] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `AudioSinkType`*"] | ||
#[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)*"] | ||
#[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
pub enum AudioSinkType { | ||
None = "none", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
enum AudioSinkType { | ||
"none" | ||
}; | ||
|
||
dictionary AudioSinkOptions { | ||
required AudioSinkType type; | ||
}; | ||
|
||
partial dictionary AudioContextOptions { | ||
(DOMString or AudioSinkOptions) sinkId; | ||
}; | ||
|
||
partial interface AudioContext { | ||
[SecureContext] readonly attribute (DOMString or AudioSinkInfo) sinkId; | ||
|
||
[SecureContext] Promise<undefined> setSinkId ((DOMString or AudioSinkOptions) sinkId); | ||
attribute EventHandler onsinkchange; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[Exposed=Window] | ||
interface AudioSinkInfo { | ||
readonly attribute AudioSinkType type; | ||
}; |