pub struct Window { /* private fields */ }
Expand description
A window, which may or may not be open.
Implementations§
Source§impl Window
impl Window
Sourcepub fn with_handler(handler: impl Handler) -> Self
pub fn with_handler(handler: impl Handler) -> Self
Make a new window with the default options and the given handler.
Examples found in repository?
More examples
Sourcepub fn eval<I: Into<String>>(&self, s: I)
pub fn eval<I: Into<String>>(&self, s: I)
Evaluate the given JavaScript asynchronously.
Examples found in repository?
More examples
examples/tick.rs (lines 42-46)
34fn ticker() {
35 for i in 0.. {
36 tether::dispatch(|| {
37 WINDOW.with(|window| {
38 window
39 .borrow()
40 .as_ref()
41 .unwrap()
42 .eval(format!(
43 "document.body.textContent = '{} ({})';",
44 if i % 2 == 1 { "Tick" } else { "Tock" },
45 i,
46 ));
47 });
48 });
49
50 thread::sleep(Duration::from_secs(1));
51 }
52}
Sourcepub fn load<I: Into<String>>(&self, s: I)
pub fn load<I: Into<String>>(&self, s: I)
Load the given HTML asynchronously.
Examples found in repository?
More examples
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Window
impl !RefUnwindSafe for Window
impl !Send for Window
impl !Sync for Window
impl Unpin for Window
impl !UnwindSafe for Window
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
Mutably borrows from an owned value. Read more