pub struct RTCPeerConnection(/* private fields */);
Implementations§
Source§impl RTCPeerConnection
impl RTCPeerConnection
pub fn restart_ice(&self) -> JsNullish
pub fn get_transceivers(&self) -> Array<RTCRtpTransceiver>
pub fn get_senders(&self) -> Array<RTCRtpSender>
pub fn get_receivers(&self) -> Array<RTCRtpReceiver>
pub fn get_configuration(&self) -> RTCConfiguration
pub fn close(&self) -> JsNullish
pub fn set_remote_description_method( &self, description: &dyn ToJs<RTCSessionDescriptionInit>, ) -> Promise<JsNullish>
pub fn set_local_description_method( &self, description: &dyn ToJs<JsNullable<RTCLocalSessionDescriptionInit>>, ) -> Promise<JsNullish>
pub fn set_configuration( &self, configuration: &dyn ToJs<JsNullable<RTCConfiguration>>, ) -> JsNullish
pub fn remove_track(&self, sender: &RTCRtpSender) -> JsNullish
pub fn get_stats( &self, selector: &dyn ToJs<JsNullable<MediaStreamTrack>>, ) -> Promise<RTCStatsReport>
pub fn create_offer( &self, options: &dyn ToJs<JsNullable<RTCOfferOptions>>, ) -> Promise<RTCSessionDescriptionInit>
pub fn create_answer( &self, options: &dyn ToJs<JsNullable<RTCAnswerOptions>>, ) -> Promise<RTCSessionDescriptionInit>
pub fn add_ice_candidate( &self, candidate: &dyn ToJs<JsNullable<RTCIceCandidateInit>>, ) -> Promise<JsNullish>
pub fn generate_certificate( browser: &Browser, keygenAlgorithm: &dyn ToJs<JsValue>, ) -> Promise<RTCCertificate>
pub fn new( browser: &Browser, configuration: &dyn ToJs<JsNullable<RTCConfiguration>>, ) -> RTCPeerConnection
pub fn create_data_channel( &self, label: &dyn ToJs<JsString>, dataChannelDict: &dyn ToJs<JsNullable<RTCDataChannelInit>>, ) -> RTCDataChannel
pub fn create_answer_with_successCallback_failureCallback( &self, successCallback: &dyn ToJs<RTCSessionDescriptionCallback>, failureCallback: &dyn ToJs<RTCPeerConnectionErrorCallback>, ) -> Promise<JsNullish>
pub fn add_transceiver( &self, trackOrKind: &dyn ToJs<JsValue>, init: &dyn ToJs<JsNullable<RTCRtpTransceiverInit>>, ) -> RTCRtpTransceiver
pub fn add_track( &self, track: &MediaStreamTrack, streams: &dyn ToJs<Array<MediaStream>>, ) -> RTCRtpSender
pub fn remove_event_listener( &self, type_: &dyn ToJs<JsString>, listener: &dyn ToJs<JsValue>, options: &dyn ToJs<JsNullable<JsValue>>, ) -> JsNullish
pub fn add_event_listener( &self, type_: &dyn ToJs<JsString>, listener: &dyn ToJs<JsValue>, options: &dyn ToJs<JsNullable<JsValue>>, ) -> JsNullish
pub fn set_remote_description_with_description_successCallback_failureCallback( &self, description: &dyn ToJs<RTCSessionDescriptionInit>, successCallback: &dyn ToJs<VoidFunction>, failureCallback: &dyn ToJs<RTCPeerConnectionErrorCallback>, ) -> Promise<JsNullish>
pub fn set_local_description_with_description_successCallback_failureCallback( &self, description: &dyn ToJs<RTCLocalSessionDescriptionInit>, successCallback: &dyn ToJs<VoidFunction>, failureCallback: &dyn ToJs<RTCPeerConnectionErrorCallback>, ) -> Promise<JsNullish>
pub fn create_offer_with_successCallback_failureCallback_options( &self, successCallback: &dyn ToJs<RTCSessionDescriptionCallback>, failureCallback: &dyn ToJs<RTCPeerConnectionErrorCallback>, options: &dyn ToJs<JsNullable<RTCOfferOptions>>, ) -> Promise<JsNullish>
pub fn add_ice_candidate_with_candidate_successCallback_failureCallback( &self, candidate: &dyn ToJs<RTCIceCandidateInit>, successCallback: &dyn ToJs<VoidFunction>, failureCallback: &dyn ToJs<RTCPeerConnectionErrorCallback>, ) -> Promise<JsNullish>
pub fn get_signaling_state(&self) -> JsString
pub fn set_signaling_state(&self, value: &dyn ToJs<JsString>)
pub fn get_sctp(&self) -> JsNullable<RTCSctpTransport>
pub fn set_sctp(&self, value: &dyn ToJs<JsNullable<RTCSctpTransport>>)
pub fn get_remote_description(&self) -> JsNullable<RTCSessionDescription>
pub fn set_remote_description( &self, value: &dyn ToJs<JsNullable<RTCSessionDescription>>, )
pub fn get_pending_remote_description( &self, ) -> JsNullable<RTCSessionDescription>
pub fn set_pending_remote_description( &self, value: &dyn ToJs<JsNullable<RTCSessionDescription>>, )
pub fn get_pending_local_description(&self) -> JsNullable<RTCSessionDescription>
pub fn set_pending_local_description( &self, value: &dyn ToJs<JsNullable<RTCSessionDescription>>, )
pub fn get_ontrack(&self) -> JsNullable<JsValue>
pub fn set_ontrack(&self, value: &dyn ToJs<JsNullable<JsValue>>)
pub fn get_onsignalingstatechange(&self) -> JsNullable<JsValue>
pub fn set_onsignalingstatechange(&self, value: &dyn ToJs<JsNullable<JsValue>>)
pub fn get_onnegotiationneeded(&self) -> JsNullable<JsValue>
pub fn set_onnegotiationneeded(&self, value: &dyn ToJs<JsNullable<JsValue>>)
pub fn get_onicegatheringstatechange(&self) -> JsNullable<JsValue>
pub fn set_onicegatheringstatechange( &self, value: &dyn ToJs<JsNullable<JsValue>>, )
pub fn get_oniceconnectionstatechange(&self) -> JsNullable<JsValue>
pub fn set_oniceconnectionstatechange( &self, value: &dyn ToJs<JsNullable<JsValue>>, )
pub fn get_onicecandidateerror(&self) -> JsNullable<JsValue>
pub fn set_onicecandidateerror(&self, value: &dyn ToJs<JsNullable<JsValue>>)
pub fn get_onicecandidate(&self) -> JsNullable<JsValue>
pub fn set_onicecandidate(&self, value: &dyn ToJs<JsNullable<JsValue>>)
pub fn get_ondatachannel(&self) -> JsNullable<JsValue>
pub fn set_ondatachannel(&self, value: &dyn ToJs<JsNullable<JsValue>>)
pub fn get_onconnectionstatechange(&self) -> JsNullable<JsValue>
pub fn set_onconnectionstatechange(&self, value: &dyn ToJs<JsNullable<JsValue>>)
pub fn get_local_description(&self) -> JsNullable<RTCSessionDescription>
pub fn set_local_description( &self, value: &dyn ToJs<JsNullable<RTCSessionDescription>>, )
pub fn get_ice_gathering_state(&self) -> JsString
pub fn set_ice_gathering_state(&self, value: &dyn ToJs<JsString>)
pub fn get_ice_connection_state(&self) -> JsString
pub fn set_ice_connection_state(&self, value: &dyn ToJs<JsString>)
pub fn get_current_remote_description( &self, ) -> JsNullable<RTCSessionDescription>
pub fn set_current_remote_description( &self, value: &dyn ToJs<JsNullable<RTCSessionDescription>>, )
pub fn get_current_local_description(&self) -> JsNullable<RTCSessionDescription>
pub fn set_current_local_description( &self, value: &dyn ToJs<JsNullable<RTCSessionDescription>>, )
pub fn get_connection_state(&self) -> JsString
pub fn set_connection_state(&self, value: &dyn ToJs<JsString>)
pub fn get_can_trickle_ice_candidates(&self) -> JsNullable<JsBoolean>
pub fn set_can_trickle_ice_candidates( &self, value: &dyn ToJs<JsNullable<JsBoolean>>, )
pub fn get_prototype(browser: &Browser) -> RTCPeerConnection
pub fn set_prototype(browser: &Browser, value: &RTCPeerConnection)
Methods from Deref<Target = EventTarget>§
pub fn dispatch_event(&self, event: &Event) -> JsBoolean
pub fn remove_event_listener( &self, type_: &dyn ToJs<JsString>, callback: &dyn ToJs<JsNullable<JsValue>>, options: &dyn ToJs<JsNullable<JsValue>>, ) -> JsNullish
pub fn add_event_listener( &self, type_: &dyn ToJs<JsString>, callback: &dyn ToJs<JsNullable<JsValue>>, options: &dyn ToJs<JsNullable<JsValue>>, ) -> JsNullish
Methods from Deref<Target = JsObject>§
Sourcepub fn js_get_field(&self, property: &dyn UseInJsCode) -> JsValue
pub fn js_get_field(&self, property: &dyn UseInJsCode) -> JsValue
Get a field value of in this object.
WSDOM provides built-in getters so you should use that instead when possible.
Use js_get_field
only when needed
fn example(browser: Browser) {
// you can get `window["location"]["href"]` like this
let href: JsValue = wsdom::dom::location(&browser).js_get_field(&"href");
// but you should use built-in getters instead
let href: JsString = wsdom::dom::location(&browser).get_href();
}
Sourcepub fn js_set_field(&self, property: &dyn UseInJsCode, value: &dyn UseInJsCode)
pub fn js_set_field(&self, property: &dyn UseInJsCode, value: &dyn UseInJsCode)
Set a field value of in this object.
WSDOM provides built-in setters so you should use that instead when possible.
Use js_set_field
only when needed
fn example(browser: Browser) {
// you can set `window["location"]["href"]` like this
wsdom::dom::location(&browser).js_set_field(&"href", &"https://example.com/");
// but you should use built-in setters instead
wsdom::dom::location(&browser).set_href(&"https://example.com");
}
Sourcepub fn js_call_method<'a>(
&'a self,
method_name: &'a str,
args: impl IntoIterator<Item = &'a dyn UseInJsCode>,
last_arg_variadic: bool,
) -> JsValue
pub fn js_call_method<'a>( &'a self, method_name: &'a str, args: impl IntoIterator<Item = &'a dyn UseInJsCode>, last_arg_variadic: bool, ) -> JsValue
Call a method on this object.
Most types in WSDOM already come with safe Rust wrappers for their methods, so you should use those instead.
fn example(browser: &Browser) {
let console = wsdom::dom::console(browser);
// you can call console.log like this
console.js_call_method("log", [&"hello" as &_], false);
// but the better way is to use
wsdom::dom::console(&browser).log(&[&"Hello" as &_]);
}
Be aware that the first argument (method_name
) is NOT escaped.
Set last_arg_variadic
to true
if you want to “spread” the last argument as obj.method(arg1, arg2, ...arg3)
.
Sourcepub fn js_call_self<'a>(
&'a self,
args: impl IntoIterator<Item = &'a dyn UseInJsCode>,
last_arg_variadic: bool,
) -> JsValue
pub fn js_call_self<'a>( &'a self, args: impl IntoIterator<Item = &'a dyn UseInJsCode>, last_arg_variadic: bool, ) -> JsValue
Call this object: obj()
.
Most types in WSDOM already come with safe Rust wrappers for their methods, so you should use those instead.
Methods from Deref<Target = JsValue>§
pub fn browser(&self) -> &Browser
Sourcepub fn retrieve_json(&self) -> RetrieveFuture<'_, Value>
pub fn retrieve_json(&self) -> RetrieveFuture<'_, Value>
Retrive this value from the JS side to the Rust side. Returns Future whose output is a serde_json::Value.
§use wsdom::dom::Browser
§use wsdom::dom::HTMLInputElement;
async fn example(input: &HTMLInputElement) { let _val = input.get_value().retrieve_json().await; }
Trait Implementations§
Source§impl AsRef<EventTarget> for RTCPeerConnection
impl AsRef<EventTarget> for RTCPeerConnection
Source§fn as_ref(&self) -> &EventTarget
fn as_ref(&self) -> &EventTarget
Source§impl AsRef<JsObject> for RTCPeerConnection
impl AsRef<JsObject> for RTCPeerConnection
Source§impl AsRef<JsValue> for RTCPeerConnection
impl AsRef<JsValue> for RTCPeerConnection
Source§impl AsRef<RTCPeerConnection> for RTCPeerConnection
impl AsRef<RTCPeerConnection> for RTCPeerConnection
Source§impl Clone for RTCPeerConnection
impl Clone for RTCPeerConnection
Source§fn clone(&self) -> RTCPeerConnection
fn clone(&self) -> RTCPeerConnection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more