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