pub struct KeyboardEventInit(/* private fields */);
Implementations§
Source§impl KeyboardEventInit
impl KeyboardEventInit
pub fn get_shift_key(&self) -> JsNullable<JsBoolean>
pub fn set_shift_key(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_modifier_symbol_lock(&self) -> JsNullable<JsBoolean>
pub fn set_modifier_symbol_lock(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_modifier_symbol(&self) -> JsNullable<JsBoolean>
pub fn set_modifier_symbol(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_modifier_super(&self) -> JsNullable<JsBoolean>
pub fn set_modifier_super(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_modifier_scroll_lock(&self) -> JsNullable<JsBoolean>
pub fn set_modifier_scroll_lock(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_modifier_num_lock(&self) -> JsNullable<JsBoolean>
pub fn set_modifier_num_lock(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_modifier_hyper(&self) -> JsNullable<JsBoolean>
pub fn set_modifier_hyper(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_modifier_fn_lock(&self) -> JsNullable<JsBoolean>
pub fn set_modifier_fn_lock(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_modifier_fn(&self) -> JsNullable<JsBoolean>
pub fn set_modifier_fn(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_modifier_caps_lock(&self) -> JsNullable<JsBoolean>
pub fn set_modifier_caps_lock(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_modifier_alt_graph(&self) -> JsNullable<JsBoolean>
pub fn set_modifier_alt_graph(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_meta_key(&self) -> JsNullable<JsBoolean>
pub fn set_meta_key(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_ctrl_key(&self) -> JsNullable<JsBoolean>
pub fn set_ctrl_key(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_alt_key(&self) -> JsNullable<JsBoolean>
pub fn set_alt_key(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_repeat(&self) -> JsNullable<JsBoolean>
pub fn set_repeat(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_location(&self) -> JsNullable<JsNumber>
pub fn set_location(&self, value: &dyn ToJs<JsNullable<JsNumber>>)
pub fn get_key_code(&self) -> JsNullable<JsNumber>
pub fn set_key_code(&self, value: &dyn ToJs<JsNullable<JsNumber>>)
pub fn get_key(&self) -> JsNullable<JsString>
pub fn set_key(&self, value: &dyn ToJs<JsNullable<JsString>>)
pub fn get_is_composing(&self) -> JsNullable<JsBoolean>
pub fn set_is_composing(&self, value: &dyn ToJs<JsNullable<JsBoolean>>)
pub fn get_code(&self) -> JsNullable<JsString>
pub fn set_code(&self, value: &dyn ToJs<JsNullable<JsString>>)
pub fn get_char_code(&self) -> JsNullable<JsNumber>
pub fn set_char_code(&self, value: &dyn ToJs<JsNullable<JsNumber>>)
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<EventInit> for KeyboardEventInit
impl AsRef<EventInit> for KeyboardEventInit
Source§impl AsRef<EventModifierInit> for KeyboardEventInit
impl AsRef<EventModifierInit> for KeyboardEventInit
Source§fn as_ref(&self) -> &EventModifierInit
fn as_ref(&self) -> &EventModifierInit
Source§impl AsRef<JsObject> for KeyboardEventInit
impl AsRef<JsObject> for KeyboardEventInit
Source§impl AsRef<JsValue> for KeyboardEventInit
impl AsRef<JsValue> for KeyboardEventInit
Source§impl AsRef<KeyboardEventInit> for KeyboardEventInit
impl AsRef<KeyboardEventInit> for KeyboardEventInit
Source§impl AsRef<UIEventInit> for KeyboardEventInit
impl AsRef<UIEventInit> for KeyboardEventInit
Source§fn as_ref(&self) -> &UIEventInit
fn as_ref(&self) -> &UIEventInit
Source§impl Clone for KeyboardEventInit
impl Clone for KeyboardEventInit
Source§fn clone(&self) -> KeyboardEventInit
fn clone(&self) -> KeyboardEventInit
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more