maxcountryman_web_sys/features/
gen_TcpSocket.rs1#![allow(unused_imports)]
2use super::*;
3use wasm_bindgen::prelude::*;
4#[wasm_bindgen]
5extern "C" {
6 # [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_name = TCPSocket , typescript_type = "TCPSocket")]
7 #[derive(Debug, Clone, PartialEq, Eq)]
8 #[doc = "The `TcpSocket` class."]
9 #[doc = ""]
10 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket)"]
11 #[doc = ""]
12 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
13 pub type TcpSocket;
14 # [wasm_bindgen (structural , method , getter , js_class = "TCPSocket" , js_name = host)]
15 #[doc = "Getter for the `host` field of this object."]
16 #[doc = ""]
17 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/host)"]
18 #[doc = ""]
19 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
20 pub fn host(this: &TcpSocket) -> String;
21 # [wasm_bindgen (structural , method , getter , js_class = "TCPSocket" , js_name = port)]
22 #[doc = "Getter for the `port` field of this object."]
23 #[doc = ""]
24 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/port)"]
25 #[doc = ""]
26 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
27 pub fn port(this: &TcpSocket) -> u16;
28 # [wasm_bindgen (structural , method , getter , js_class = "TCPSocket" , js_name = ssl)]
29 #[doc = "Getter for the `ssl` field of this object."]
30 #[doc = ""]
31 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/ssl)"]
32 #[doc = ""]
33 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
34 pub fn ssl(this: &TcpSocket) -> bool;
35 # [wasm_bindgen (structural , method , getter , js_class = "TCPSocket" , js_name = bufferedAmount)]
36 #[doc = "Getter for the `bufferedAmount` field of this object."]
37 #[doc = ""]
38 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/bufferedAmount)"]
39 #[doc = ""]
40 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
41 pub fn buffered_amount(this: &TcpSocket) -> f64;
42 #[cfg(feature = "TcpReadyState")]
43 # [wasm_bindgen (structural , method , getter , js_class = "TCPSocket" , js_name = readyState)]
44 #[doc = "Getter for the `readyState` field of this object."]
45 #[doc = ""]
46 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/readyState)"]
47 #[doc = ""]
48 #[doc = "*This API requires the following crate features to be activated: `TcpReadyState`, `TcpSocket`*"]
49 pub fn ready_state(this: &TcpSocket) -> TcpReadyState;
50 #[cfg(feature = "TcpSocketBinaryType")]
51 # [wasm_bindgen (structural , method , getter , js_class = "TCPSocket" , js_name = binaryType)]
52 #[doc = "Getter for the `binaryType` field of this object."]
53 #[doc = ""]
54 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/binaryType)"]
55 #[doc = ""]
56 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`, `TcpSocketBinaryType`*"]
57 pub fn binary_type(this: &TcpSocket) -> TcpSocketBinaryType;
58 # [wasm_bindgen (structural , method , getter , js_class = "TCPSocket" , js_name = onopen)]
59 #[doc = "Getter for the `onopen` field of this object."]
60 #[doc = ""]
61 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/onopen)"]
62 #[doc = ""]
63 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
64 pub fn onopen(this: &TcpSocket) -> Option<::js_sys::Function>;
65 # [wasm_bindgen (structural , method , setter , js_class = "TCPSocket" , js_name = onopen)]
66 #[doc = "Setter for the `onopen` field of this object."]
67 #[doc = ""]
68 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/onopen)"]
69 #[doc = ""]
70 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
71 pub fn set_onopen(this: &TcpSocket, value: Option<&::js_sys::Function>);
72 # [wasm_bindgen (structural , method , getter , js_class = "TCPSocket" , js_name = ondrain)]
73 #[doc = "Getter for the `ondrain` field of this object."]
74 #[doc = ""]
75 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/ondrain)"]
76 #[doc = ""]
77 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
78 pub fn ondrain(this: &TcpSocket) -> Option<::js_sys::Function>;
79 # [wasm_bindgen (structural , method , setter , js_class = "TCPSocket" , js_name = ondrain)]
80 #[doc = "Setter for the `ondrain` field of this object."]
81 #[doc = ""]
82 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/ondrain)"]
83 #[doc = ""]
84 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
85 pub fn set_ondrain(this: &TcpSocket, value: Option<&::js_sys::Function>);
86 # [wasm_bindgen (structural , method , getter , js_class = "TCPSocket" , js_name = ondata)]
87 #[doc = "Getter for the `ondata` field of this object."]
88 #[doc = ""]
89 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/ondata)"]
90 #[doc = ""]
91 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
92 pub fn ondata(this: &TcpSocket) -> Option<::js_sys::Function>;
93 # [wasm_bindgen (structural , method , setter , js_class = "TCPSocket" , js_name = ondata)]
94 #[doc = "Setter for the `ondata` field of this object."]
95 #[doc = ""]
96 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/ondata)"]
97 #[doc = ""]
98 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
99 pub fn set_ondata(this: &TcpSocket, value: Option<&::js_sys::Function>);
100 # [wasm_bindgen (structural , method , getter , js_class = "TCPSocket" , js_name = onerror)]
101 #[doc = "Getter for the `onerror` field of this object."]
102 #[doc = ""]
103 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/onerror)"]
104 #[doc = ""]
105 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
106 pub fn onerror(this: &TcpSocket) -> Option<::js_sys::Function>;
107 # [wasm_bindgen (structural , method , setter , js_class = "TCPSocket" , js_name = onerror)]
108 #[doc = "Setter for the `onerror` field of this object."]
109 #[doc = ""]
110 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/onerror)"]
111 #[doc = ""]
112 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
113 pub fn set_onerror(this: &TcpSocket, value: Option<&::js_sys::Function>);
114 # [wasm_bindgen (structural , method , getter , js_class = "TCPSocket" , js_name = onclose)]
115 #[doc = "Getter for the `onclose` field of this object."]
116 #[doc = ""]
117 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/onclose)"]
118 #[doc = ""]
119 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
120 pub fn onclose(this: &TcpSocket) -> Option<::js_sys::Function>;
121 # [wasm_bindgen (structural , method , setter , js_class = "TCPSocket" , js_name = onclose)]
122 #[doc = "Setter for the `onclose` field of this object."]
123 #[doc = ""]
124 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/onclose)"]
125 #[doc = ""]
126 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
127 pub fn set_onclose(this: &TcpSocket, value: Option<&::js_sys::Function>);
128 #[wasm_bindgen(catch, constructor, js_class = "TCPSocket")]
129 #[doc = "The `new TcpSocket(..)` constructor, creating a new instance of `TcpSocket`."]
130 #[doc = ""]
131 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/TCPSocket)"]
132 #[doc = ""]
133 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
134 pub fn new(host: &str, port: u16) -> Result<TcpSocket, JsValue>;
135 #[cfg(feature = "SocketOptions")]
136 #[wasm_bindgen(catch, constructor, js_class = "TCPSocket")]
137 #[doc = "The `new TcpSocket(..)` constructor, creating a new instance of `TcpSocket`."]
138 #[doc = ""]
139 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/TCPSocket)"]
140 #[doc = ""]
141 #[doc = "*This API requires the following crate features to be activated: `SocketOptions`, `TcpSocket`*"]
142 pub fn new_with_options(
143 host: &str,
144 port: u16,
145 options: &SocketOptions,
146 ) -> Result<TcpSocket, JsValue>;
147 # [wasm_bindgen (method , structural , js_class = "TCPSocket" , js_name = close)]
148 #[doc = "The `close()` method."]
149 #[doc = ""]
150 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/close)"]
151 #[doc = ""]
152 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
153 pub fn close(this: &TcpSocket);
154 # [wasm_bindgen (catch , method , structural , js_class = "TCPSocket" , js_name = resume)]
155 #[doc = "The `resume()` method."]
156 #[doc = ""]
157 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/resume)"]
158 #[doc = ""]
159 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
160 pub fn resume(this: &TcpSocket) -> Result<(), JsValue>;
161 # [wasm_bindgen (catch , method , structural , js_class = "TCPSocket" , js_name = send)]
162 #[doc = "The `send()` method."]
163 #[doc = ""]
164 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/send)"]
165 #[doc = ""]
166 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
167 pub fn send_with_str(this: &TcpSocket, data: &str) -> Result<bool, JsValue>;
168 # [wasm_bindgen (catch , method , structural , js_class = "TCPSocket" , js_name = send)]
169 #[doc = "The `send()` method."]
170 #[doc = ""]
171 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/send)"]
172 #[doc = ""]
173 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
174 pub fn send_with_array_buffer(
175 this: &TcpSocket,
176 data: &::js_sys::ArrayBuffer,
177 ) -> Result<bool, JsValue>;
178 # [wasm_bindgen (catch , method , structural , js_class = "TCPSocket" , js_name = send)]
179 #[doc = "The `send()` method."]
180 #[doc = ""]
181 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/send)"]
182 #[doc = ""]
183 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
184 pub fn send_with_array_buffer_and_byte_offset(
185 this: &TcpSocket,
186 data: &::js_sys::ArrayBuffer,
187 byte_offset: u32,
188 ) -> Result<bool, JsValue>;
189 # [wasm_bindgen (catch , method , structural , js_class = "TCPSocket" , js_name = send)]
190 #[doc = "The `send()` method."]
191 #[doc = ""]
192 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/send)"]
193 #[doc = ""]
194 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
195 pub fn send_with_array_buffer_and_byte_offset_and_byte_length(
196 this: &TcpSocket,
197 data: &::js_sys::ArrayBuffer,
198 byte_offset: u32,
199 byte_length: u32,
200 ) -> Result<bool, JsValue>;
201 # [wasm_bindgen (method , structural , js_class = "TCPSocket" , js_name = suspend)]
202 #[doc = "The `suspend()` method."]
203 #[doc = ""]
204 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/suspend)"]
205 #[doc = ""]
206 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
207 pub fn suspend(this: &TcpSocket);
208 # [wasm_bindgen (catch , method , structural , js_class = "TCPSocket" , js_name = upgradeToSecure)]
209 #[doc = "The `upgradeToSecure()` method."]
210 #[doc = ""]
211 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/upgradeToSecure)"]
212 #[doc = ""]
213 #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"]
214 pub fn upgrade_to_secure(this: &TcpSocket) -> Result<(), JsValue>;
215}