pub struct WebContents { /* private fields */ }
Expand description
Docs: http://electronjs.org/docs/api/web-contents
Implementations§
Source§impl WebContents
impl WebContents
pub fn from_id(id: usize) -> WebContents
Source§impl WebContents
impl WebContents
pub fn get_all_web_contents() -> Box<[JsValue]>
Source§impl WebContents
impl WebContents
pub fn get_focused_web_contents() -> WebContents
Source§impl WebContents
impl WebContents
pub fn add_work_space(&self, path: &str)
Source§impl WebContents
impl WebContents
pub fn begin_frame_subscription(&self, only_dirty: bool, callback: &Function)
Source§impl WebContents
impl WebContents
pub fn can_go_back(&self) -> bool
Source§impl WebContents
impl WebContents
pub fn can_go_forward(&self) -> bool
Source§impl WebContents
impl WebContents
pub fn can_go_to_offset(&self, offset: u32) -> bool
Source§impl WebContents
impl WebContents
pub fn capture_page(&self, rectangle: Option<Rectangle>) -> Promise
Source§impl WebContents
impl WebContents
pub fn clear_history(&self)
Source§impl WebContents
impl WebContents
pub fn close_dev_tools(&self)
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
pub fn copy_image_at(&self, x: usize, y: usize)
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
pub fn disable_device_emulation(&self)
Source§impl WebContents
impl WebContents
pub fn download_url(&self)
Source§impl WebContents
impl WebContents
pub fn enable_device_emulation(&self, options: EnableDeviceEmulationOptions)
Source§impl WebContents
impl WebContents
pub fn end_frame_subscription(&self)
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
pub fn find_in_page( &self, text: &str, options: Option<FindInPageOptions>, ) -> usize
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
pub fn get_os_process_id(&self) -> u32
Source§impl WebContents
impl WebContents
pub fn get_printers(&self)
Source§impl WebContents
impl WebContents
pub fn get_process_id(&self) -> u32
Source§impl WebContents
impl WebContents
pub fn get_web_rtc_ip_handling_policy(&self) -> JsString
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
pub fn go_forward(&self)
Source§impl WebContents
impl WebContents
pub fn go_to_index(&self, index: usize)
Source§impl WebContents
impl WebContents
pub fn go_to_offset(&self, index: usize)
Source§impl WebContents
impl WebContents
pub fn insert_css( &self, css: &str, options: Option<InsertCssOptions>, ) -> Promise
Source§impl WebContents
impl WebContents
pub fn insert_text(&self, text: &str) -> Promise
Source§impl WebContents
impl WebContents
pub fn inspect_element(&self, x: usize, y: usize)
Source§impl WebContents
impl WebContents
pub fn inspect_service_worker(&self)
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
pub fn invalidate(&self)
Source§impl WebContents
impl WebContents
pub fn is_crashed(&self) -> bool
Source§impl WebContents
impl WebContents
pub fn is_currently_audible(&self) -> bool
Source§impl WebContents
impl WebContents
pub fn is_destroyed(&self) -> bool
Source§impl WebContents
impl WebContents
pub fn is_dev_tools_focused(&self) -> bool
Source§impl WebContents
impl WebContents
pub fn is_dev_tools_opened(&self) -> bool
Source§impl WebContents
impl WebContents
pub fn is_focused(&self) -> bool
Source§impl WebContents
impl WebContents
pub fn is_loading(&self) -> bool
Source§impl WebContents
impl WebContents
pub fn is_loading_main_frame(&self) -> bool
Source§impl WebContents
impl WebContents
pub fn is_offscreen(&self) -> bool
Source§impl WebContents
impl WebContents
pub fn is_painting(&self) -> bool
Source§impl WebContents
impl WebContents
pub fn is_waiting_for_response(&self) -> bool
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
pub fn open_dev_tools(&self, options: Option<OpenDevToolsOptions>)
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
pub fn paste_and_match_style(&self)
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
pub fn print_to_pdf(&self, options: PrintToPdfOptions) -> Promise
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
pub fn reload_ignoring_cache(&self)
Source§impl WebContents
impl WebContents
pub fn remove_inserted_css(&self, key: &str) -> Promise
Source§impl WebContents
impl WebContents
pub fn remove_work_space(&self, path: &str)
Source§impl WebContents
impl WebContents
pub fn replaceMisspelling(&self, text: &str)
Source§impl WebContents
impl WebContents
pub fn select_all(&self)
Source§impl WebContents
impl WebContents
pub fn send_input_event(&self, input_event: &InputEvent)
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
pub fn set_background_throttling(&self, allowed: bool)
Source§impl WebContents
impl WebContents
pub fn set_dev_tools_web_contents(&self, dev_tools_web_contents: &WebContents)
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
pub fn set_layout_zoom_level_limits(&self, min: f32, max: f32) -> Promise
Source§impl WebContents
impl WebContents
pub fn set_visual_zoom_level_limits(&self, min: f32, max: f32) -> Promise
Source§impl WebContents
impl WebContents
pub fn set_web_rtc_ip_handling_policy(&self, policy: &str)
Source§impl WebContents
impl WebContents
pub fn show_definition_for_selection(&self)
Source§impl WebContents
impl WebContents
pub fn start_drag(&self, item: Item)
Source§impl WebContents
impl WebContents
pub fn start_painting(&self)
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
pub fn stop_finding_in_page(&self, action: &str)
Source§impl WebContents
impl WebContents
pub fn stop_painting(&self)
Source§impl WebContents
impl WebContents
pub fn take_heap_snapshot(&self)
Source§impl WebContents
impl WebContents
pub fn toggle_dev_tools(&self)
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
Source§impl WebContents
impl WebContents
pub fn audio_muted(&self) -> bool
Source§impl WebContents
impl WebContents
pub fn set_audio_muted(&self, value: bool)
Source§impl WebContents
impl WebContents
pub fn dev_tools_web_contents(&self) -> WebContents
Source§impl WebContents
impl WebContents
pub fn frame_rate(&self) -> f32
Source§impl WebContents
impl WebContents
pub fn set_frame_rate(&self, value: f32)
Source§impl WebContents
impl WebContents
pub fn host_web_contents(&self) -> WebContents
Source§impl WebContents
impl WebContents
pub fn user_agent(&self) -> JsString
Source§impl WebContents
impl WebContents
pub fn zoom_factor(&self) -> f32
Source§impl WebContents
impl WebContents
pub fn set_zoom_factor(&self, value: f32)
Source§impl WebContents
impl WebContents
pub fn zoom_level(&self) -> f32
Source§impl WebContents
impl WebContents
pub fn set_zoom_level(&self, value: f32)
Methods from Deref<Target = EventEmitter>§
pub fn default_max_listeners(&self) -> f64
pub fn set_default_max_listeners(&self, value: f64)
pub fn add_listener( &self, event_name: &str, listener: &Function, ) -> EventEmitter
pub fn emit(&self, event_name: &str, args: Box<[JsValue]>) -> bool
pub fn event_names(&self) -> Box<[JsValue]>
pub fn get_max_listeners(&self)
pub fn listener_count(&self) -> f64
pub fn listeners(&self, event_name: &str) -> Box<[JsValue]>
pub fn off(&self, event_name: &str, listener: &Function) -> EventEmitter
pub fn on(&self, event_name: &str, listener: &Function) -> EventEmitter
pub fn once(&self, event_name: &str, listener: &Function) -> EventEmitter
pub fn prepend_listener( &self, event_name: &str, listener: &Function, ) -> EventEmitter
pub fn prepend_once_listener( &self, event_name: &str, listener: &Function, ) -> EventEmitter
pub fn remove_all_listeners(&self, event_name: Option<&str>) -> EventEmitter
pub fn remove_listener( &self, event_name: &str, listener: &Function, ) -> EventEmitter
pub fn set_max_listeners(&self, n: f64) -> EventEmitter
pub fn raw_listeners(&self, event_name: &str) -> Box<[JsValue]>
Methods from Deref<Target = Object>§
Sourcepub fn constructor(&self) -> Function
pub fn constructor(&self) -> Function
The constructor property returns a reference to the Object
constructor
function that created the instance object.
Sourcepub fn has_own_property(&self, property: &JsValue) -> bool
pub fn has_own_property(&self, property: &JsValue) -> bool
The hasOwnProperty()
method returns a boolean indicating whether the
object has the specified property as its own property (as opposed to
inheriting it).
Sourcepub fn is_prototype_of(&self, value: &JsValue) -> bool
pub fn is_prototype_of(&self, value: &JsValue) -> bool
The isPrototypeOf()
method checks if an object exists in another
object’s prototype chain.
Sourcepub fn property_is_enumerable(&self, property: &JsValue) -> bool
pub fn property_is_enumerable(&self, property: &JsValue) -> bool
The propertyIsEnumerable()
method returns a Boolean indicating
whether the specified property is enumerable.
Sourcepub fn to_locale_string(&self) -> JsString
pub fn to_locale_string(&self) -> JsString
The toLocaleString()
method returns a string representing the object.
This method is meant to be overridden by derived objects for
locale-specific purposes.
Sourcepub fn to_string(&self) -> JsString
pub fn to_string(&self) -> JsString
The toString()
method returns a string representing the object.
Methods from Deref<Target = JsValue>§
pub const NULL: JsValue
pub const UNDEFINED: JsValue
pub const TRUE: JsValue
pub const FALSE: JsValue
Sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Returns the f64
value of this JS value if it’s an instance of a
number.
If this JS value is not an instance of a number then this returns
None
.
Sourcepub fn as_string(&self) -> Option<String>
pub fn as_string(&self) -> Option<String>
If this JS value is a string value, this function copies the JS string
value into Wasm linear memory, encoded as UTF-8, and returns it as a
Rust String
.
To avoid the copying and re-encoding, consider the
JsString::try_from()
function from js-sys
instead.
If this JS value is not an instance of a string or if it’s not valid
utf-8 then this returns None
.
§UTF-16 vs UTF-8
JavaScript strings in general are encoded as UTF-16, but Rust strings
are encoded as UTF-8. This can cause the Rust string to look a bit
different than the JS string sometimes. For more details see the
documentation about the str
type which contains a few
caveats about the encodings.
Sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Returns the bool
value of this JS value if it’s an instance of a
boolean.
If this JS value is not an instance of a boolean then this returns
None
.
Sourcepub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
Tests whether this JS value is undefined
Sourcepub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
Tests whether the type of this JS value is function
.
Sourcepub fn js_in(&self, obj: &JsValue) -> bool
pub fn js_in(&self, obj: &JsValue) -> bool
Applies the binary in
JS operator on the two JsValue
s.
Sourcepub fn loose_eq(&self, other: &JsValue) -> bool
pub fn loose_eq(&self, other: &JsValue) -> bool
Compare two JsValue
s for equality, using the ==
operator in JS.
Sourcepub fn unsigned_shr(&self, rhs: &JsValue) -> u32
pub fn unsigned_shr(&self, rhs: &JsValue) -> u32
Applies the binary >>>
JS operator on the two JsValue
s.
Sourcepub fn checked_div(&self, rhs: &JsValue) -> JsValue
pub fn checked_div(&self, rhs: &JsValue) -> JsValue
Applies the binary /
JS operator on two JsValue
s, catching and returning any RangeError
thrown.
Sourcepub fn pow(&self, rhs: &JsValue) -> JsValue
pub fn pow(&self, rhs: &JsValue) -> JsValue
Applies the binary **
JS operator on the two JsValue
s.
Sourcepub fn lt(&self, other: &JsValue) -> bool
pub fn lt(&self, other: &JsValue) -> bool
Applies the binary <
JS operator on the two JsValue
s.
Sourcepub fn le(&self, other: &JsValue) -> bool
pub fn le(&self, other: &JsValue) -> bool
Applies the binary <=
JS operator on the two JsValue
s.
Sourcepub fn ge(&self, other: &JsValue) -> bool
pub fn ge(&self, other: &JsValue) -> bool
Applies the binary >=
JS operator on the two JsValue
s.
Sourcepub fn gt(&self, other: &JsValue) -> bool
pub fn gt(&self, other: &JsValue) -> bool
Applies the binary >
JS operator on the two JsValue
s.
Sourcepub fn unchecked_into_f64(&self) -> f64
pub fn unchecked_into_f64(&self) -> f64
Applies the unary +
JS operator on a JsValue
. Can throw.
Trait Implementations§
Source§impl AsRef<EventEmitter> for WebContents
impl AsRef<EventEmitter> for WebContents
Source§fn as_ref(&self) -> &EventEmitter
fn as_ref(&self) -> &EventEmitter
Source§impl AsRef<JsValue> for WebContents
impl AsRef<JsValue> for WebContents
Source§impl AsRef<WebContents> for WebContents
impl AsRef<WebContents> for WebContents
Source§fn as_ref(&self) -> &WebContents
fn as_ref(&self) -> &WebContents
Source§impl Deref for WebContents
impl Deref for WebContents
Source§type Target = EventEmitter
type Target = EventEmitter
Source§fn deref(&self) -> &EventEmitter
fn deref(&self) -> &EventEmitter
Source§impl From<JsValue> for WebContents
impl From<JsValue> for WebContents
Source§fn from(obj: JsValue) -> WebContents
fn from(obj: JsValue) -> WebContents
Source§impl From<WebContents> for EventEmitter
impl From<WebContents> for EventEmitter
Source§fn from(obj: WebContents) -> EventEmitter
fn from(obj: WebContents) -> EventEmitter
Source§impl From<WebContents> for JsValue
impl From<WebContents> for JsValue
Source§fn from(obj: WebContents) -> JsValue
fn from(obj: WebContents) -> JsValue
Source§impl FromWasmAbi for WebContents
impl FromWasmAbi for WebContents
Source§impl<'a> IntoWasmAbi for &'a WebContents
impl<'a> IntoWasmAbi for &'a WebContents
Source§impl IntoWasmAbi for WebContents
impl IntoWasmAbi for WebContents
Source§impl JsCast for WebContents
impl JsCast for WebContents
Source§fn instanceof(val: &JsValue) -> bool
fn instanceof(val: &JsValue) -> bool
instanceof
check to see whether the JsValue
provided is an instance of this type. Read moreSource§fn unchecked_from_js(val: JsValue) -> Self
fn unchecked_from_js(val: JsValue) -> Self
Source§fn unchecked_from_js_ref(val: &JsValue) -> &Self
fn unchecked_from_js_ref(val: &JsValue) -> &Self
Source§fn has_type<T>(&self) -> boolwhere
T: JsCast,
fn has_type<T>(&self) -> boolwhere
T: JsCast,
T
. Read moreSource§fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
T
. Read moreSource§fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
T
. Read moreSource§fn unchecked_into<T>(self) -> Twhere
T: JsCast,
fn unchecked_into<T>(self) -> Twhere
T: JsCast,
Source§fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
Source§impl LongRefFromWasmAbi for WebContents
impl LongRefFromWasmAbi for WebContents
Source§type Anchor = WebContents
type Anchor = WebContents
RefFromWasmAbi::Anchor
Source§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abi
Source§impl OptionFromWasmAbi for WebContents
impl OptionFromWasmAbi for WebContents
Source§impl<'a> OptionIntoWasmAbi for &'a WebContents
impl<'a> OptionIntoWasmAbi for &'a WebContents
Source§impl OptionIntoWasmAbi for WebContents
impl OptionIntoWasmAbi for WebContents
Source§impl RefFromWasmAbi for WebContents
impl RefFromWasmAbi for WebContents
Source§type Abi = <JsValue as RefFromWasmAbi>::Abi
type Abi = <JsValue as RefFromWasmAbi>::Abi
Self
are recovered from.Source§type Anchor = ManuallyDrop<WebContents>
type Anchor = ManuallyDrop<WebContents>
Self
for the duration of the
invocation of the function that has an &Self
parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Auto Trait Implementations§
impl Freeze for WebContents
impl RefUnwindSafe for WebContents
impl !Send for WebContents
impl !Sync for WebContents
impl Unpin for WebContents
impl UnwindSafe for WebContents
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::Abi
Source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
.