pub struct SourceBuffer(/* private fields */);
Implementations§
Source§impl SourceBuffer
impl SourceBuffer
pub fn abort(&self) -> JsNullish
pub fn new(browser: &Browser) -> SourceBuffer
pub fn change_type(&self, type_: &dyn ToJs<JsString>) -> JsNullish
pub fn append_buffer(&self, data: &dyn ToJs<JsValue>) -> JsNullish
pub fn remove( &self, start: &dyn ToJs<JsNumber>, end: &dyn ToJs<JsNumber>, ) -> JsNullish
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 get_updating(&self) -> JsBoolean
pub fn set_updating(&self, value: &dyn ToJs<JsBoolean>)
pub fn get_timestamp_offset(&self) -> JsNumber
pub fn set_timestamp_offset(&self, value: &dyn ToJs<JsNumber>)
pub fn get_onupdatestart(&self) -> JsNullable<JsValue>
pub fn set_onupdatestart(&self, value: &dyn ToJs<JsNullable<JsValue>>)
pub fn get_onupdateend(&self) -> JsNullable<JsValue>
pub fn set_onupdateend(&self, value: &dyn ToJs<JsNullable<JsValue>>)
pub fn get_onupdate(&self) -> JsNullable<JsValue>
pub fn set_onupdate(&self, value: &dyn ToJs<JsNullable<JsValue>>)
pub fn get_onerror(&self) -> JsNullable<JsValue>
pub fn set_onerror(&self, value: &dyn ToJs<JsNullable<JsValue>>)
pub fn get_onabort(&self) -> JsNullable<JsValue>
pub fn set_onabort(&self, value: &dyn ToJs<JsNullable<JsValue>>)
pub fn get_mode(&self) -> JsString
pub fn set_mode(&self, value: &dyn ToJs<JsString>)
pub fn get_buffered(&self) -> TimeRanges
pub fn set_buffered(&self, value: &TimeRanges)
pub fn get_append_window_start(&self) -> JsNumber
pub fn set_append_window_start(&self, value: &dyn ToJs<JsNumber>)
pub fn get_append_window_end(&self) -> JsNumber
pub fn set_append_window_end(&self, value: &dyn ToJs<JsNumber>)
pub fn get_prototype(browser: &Browser) -> SourceBuffer
pub fn set_prototype(browser: &Browser, value: &SourceBuffer)
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 SourceBuffer
impl AsRef<EventTarget> for SourceBuffer
Source§fn as_ref(&self) -> &EventTarget
fn as_ref(&self) -> &EventTarget
Source§impl AsRef<JsObject> for SourceBuffer
impl AsRef<JsObject> for SourceBuffer
Source§impl AsRef<JsValue> for SourceBuffer
impl AsRef<JsValue> for SourceBuffer
Source§impl AsRef<SourceBuffer> for SourceBuffer
impl AsRef<SourceBuffer> for SourceBuffer
Source§impl Clone for SourceBuffer
impl Clone for SourceBuffer
Source§fn clone(&self) -> SourceBuffer
fn clone(&self) -> SourceBuffer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more