pub struct Navigator(/* private fields */);
Implementations§
pub fn java_enabled(&self) -> JsBoolean
pub fn clear_app_badge(&self) -> Promise<JsNullish>
pub fn get_gamepads(&self) -> Array<JsNullable<Gamepad>>
pub fn new(browser: &Browser) -> Navigator
pub fn set_app_badge( &self, contents: &dyn ToJs<JsNullable<JsNumber>>, ) -> Promise<JsNullish>
pub fn vibrate(&self, pattern: &dyn ToJs<JsValue>) -> JsBoolean
pub fn request_midiaccess( &self, options: &dyn ToJs<JsNullable<MIDIOptions>>, ) -> Promise<MIDIAccess>
pub fn register_protocol_handler( &self, scheme: &dyn ToJs<JsString>, url: &dyn ToJs<JsValue>, ) -> JsNullish
pub fn send_beacon( &self, url: &dyn ToJs<JsValue>, data: &dyn ToJs<JsNullable<JsValue>>, ) -> JsBoolean
pub fn request_media_key_system_access( &self, keySystem: &dyn ToJs<JsString>, supportedConfigurations: &dyn ToJs<Array<MediaKeySystemConfiguration>>, ) -> Promise<MediaKeySystemAccess>
pub fn get_storage(&self) -> StorageManager
pub fn set_storage(&self, value: &StorageManager)
pub fn get_plugins(&self) -> PluginArray
pub fn set_plugins(&self, value: &PluginArray)
pub fn get_pdf_viewer_enabled(&self) -> JsBoolean
pub fn set_pdf_viewer_enabled(&self, value: &dyn ToJs<JsBoolean>)
pub fn get_mime_types(&self) -> MimeTypeArray
pub fn set_mime_types(&self, value: &MimeTypeArray)
pub fn get_on_line(&self) -> JsBoolean
pub fn set_on_line(&self, value: &dyn ToJs<JsBoolean>)
pub fn get_locks(&self) -> LockManager
pub fn set_locks(&self, value: &LockManager)
pub fn get_languages(&self) -> Array<JsString>
pub fn set_languages(&self, value: &dyn ToJs<Array<JsString>>)
pub fn get_language(&self) -> JsString
pub fn set_language(&self, value: &dyn ToJs<JsString>)
pub fn get_vendor_sub(&self) -> JsString
pub fn set_vendor_sub(&self, value: &dyn ToJs<JsString>)
pub fn get_vendor(&self) -> JsString
pub fn set_vendor(&self, value: &dyn ToJs<JsString>)
pub fn get_user_agent(&self) -> JsString
pub fn set_user_agent(&self, value: &dyn ToJs<JsString>)
pub fn get_product_sub(&self) -> JsString
pub fn set_product_sub(&self, value: &dyn ToJs<JsString>)
pub fn get_product(&self) -> JsString
pub fn set_product(&self, value: &dyn ToJs<JsString>)
pub fn get_platform(&self) -> JsString
pub fn set_platform(&self, value: &dyn ToJs<JsString>)
pub fn get_app_version(&self) -> JsString
pub fn set_app_version(&self, value: &dyn ToJs<JsString>)
pub fn get_app_name(&self) -> JsString
pub fn set_app_name(&self, value: &dyn ToJs<JsString>)
pub fn get_app_code_name(&self) -> JsString
pub fn set_app_code_name(&self, value: &dyn ToJs<JsString>)
pub fn get_hardware_concurrency(&self) -> JsNumber
pub fn set_hardware_concurrency(&self, value: &dyn ToJs<JsNumber>)
pub fn get_webdriver(&self) -> JsBoolean
pub fn set_webdriver(&self, value: &dyn ToJs<JsBoolean>)
pub fn get_wake_lock(&self) -> WakeLock
pub fn set_wake_lock(&self, value: &WakeLock)
pub fn get_user_activation(&self) -> UserActivation
pub fn set_user_activation(&self, value: &UserActivation)
pub fn get_service_worker(&self) -> ServiceWorkerContainer
pub fn set_service_worker(&self, value: &ServiceWorkerContainer)
pub fn get_permissions(&self) -> Permissions
pub fn set_permissions(&self, value: &Permissions)
pub fn get_media_session(&self) -> MediaSession
pub fn set_media_session(&self, value: &MediaSession)
pub fn get_media_devices(&self) -> MediaDevices
pub fn set_media_devices(&self, value: &MediaDevices)
pub fn get_media_capabilities(&self) -> MediaCapabilities
pub fn set_media_capabilities(&self, value: &MediaCapabilities)
pub fn get_max_touch_points(&self) -> JsNumber
pub fn set_max_touch_points(&self, value: &dyn ToJs<JsNumber>)
pub fn get_geolocation(&self) -> Geolocation
pub fn set_geolocation(&self, value: &Geolocation)
pub fn get_do_not_track(&self) -> JsNullable<JsString>
pub fn set_do_not_track(&self, value: &dyn ToJs<JsNullable<JsString>>)
pub fn get_credentials(&self) -> CredentialsContainer
pub fn set_credentials(&self, value: &CredentialsContainer)
pub fn get_clipboard(&self) -> Clipboard
pub fn set_clipboard(&self, value: &Clipboard)
pub fn get_prototype(browser: &Browser) -> Navigator
pub fn set_prototype(browser: &Browser, value: &Navigator)
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; }