web_sys/features/
gen_BroadcastChannel.rs1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7 #[wasm_bindgen(
8 extends = "EventTarget",
9 extends = "::js_sys::Object",
10 js_name = "BroadcastChannel",
11 typescript_type = "BroadcastChannel"
12 )]
13 #[derive(Debug, Clone, PartialEq, Eq)]
14 #[doc = "The `BroadcastChannel` class."]
15 #[doc = ""]
16 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel)"]
17 #[doc = ""]
18 #[doc = "*This API requires the following crate features to be activated: `BroadcastChannel`*"]
19 pub type BroadcastChannel;
20 #[wasm_bindgen(method, getter, js_class = "BroadcastChannel", js_name = "name")]
21 #[doc = "Getter for the `name` field of this object."]
22 #[doc = ""]
23 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel/name)"]
24 #[doc = ""]
25 #[doc = "*This API requires the following crate features to be activated: `BroadcastChannel`*"]
26 pub fn name(this: &BroadcastChannel) -> ::alloc::string::String;
27 #[wasm_bindgen(method, getter, js_class = "BroadcastChannel", js_name = "onmessage")]
28 #[doc = "Getter for the `onmessage` field of this object."]
29 #[doc = ""]
30 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel/onmessage)"]
31 #[doc = ""]
32 #[doc = "*This API requires the following crate features to be activated: `BroadcastChannel`*"]
33 pub fn onmessage(this: &BroadcastChannel) -> Option<::js_sys::Function>;
34 #[wasm_bindgen(method, setter, js_class = "BroadcastChannel", js_name = "onmessage")]
35 #[doc = "Setter for the `onmessage` field of this object."]
36 #[doc = ""]
37 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel/onmessage)"]
38 #[doc = ""]
39 #[doc = "*This API requires the following crate features to be activated: `BroadcastChannel`*"]
40 pub fn set_onmessage(this: &BroadcastChannel, value: Option<&::js_sys::Function>);
41 #[wasm_bindgen(
42 method,
43 getter,
44 js_class = "BroadcastChannel",
45 js_name = "onmessageerror"
46 )]
47 #[doc = "Getter for the `onmessageerror` field of this object."]
48 #[doc = ""]
49 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel/onmessageerror)"]
50 #[doc = ""]
51 #[doc = "*This API requires the following crate features to be activated: `BroadcastChannel`*"]
52 pub fn onmessageerror(this: &BroadcastChannel) -> Option<::js_sys::Function>;
53 #[wasm_bindgen(
54 method,
55 setter,
56 js_class = "BroadcastChannel",
57 js_name = "onmessageerror"
58 )]
59 #[doc = "Setter for the `onmessageerror` field of this object."]
60 #[doc = ""]
61 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel/onmessageerror)"]
62 #[doc = ""]
63 #[doc = "*This API requires the following crate features to be activated: `BroadcastChannel`*"]
64 pub fn set_onmessageerror(this: &BroadcastChannel, value: Option<&::js_sys::Function>);
65 #[wasm_bindgen(catch, constructor, js_class = "BroadcastChannel")]
66 #[doc = "The `new BroadcastChannel(..)` constructor, creating a new instance of `BroadcastChannel`."]
67 #[doc = ""]
68 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel/BroadcastChannel)"]
69 #[doc = ""]
70 #[doc = "*This API requires the following crate features to be activated: `BroadcastChannel`*"]
71 pub fn new(channel: &str) -> Result<BroadcastChannel, JsValue>;
72 #[wasm_bindgen(method, js_class = "BroadcastChannel")]
73 #[doc = "The `close()` method."]
74 #[doc = ""]
75 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel/close)"]
76 #[doc = ""]
77 #[doc = "*This API requires the following crate features to be activated: `BroadcastChannel`*"]
78 pub fn close(this: &BroadcastChannel);
79 #[wasm_bindgen(catch, method, js_class = "BroadcastChannel", js_name = "postMessage")]
80 #[doc = "The `postMessage()` method."]
81 #[doc = ""]
82 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel/postMessage)"]
83 #[doc = ""]
84 #[doc = "*This API requires the following crate features to be activated: `BroadcastChannel`*"]
85 pub fn post_message(
86 this: &BroadcastChannel,
87 message: &::wasm_bindgen::JsValue,
88 ) -> Result<(), JsValue>;
89}