[−][src]Struct stdweb::web::Window
The Window
object represents a window containing a DOM document.
Methods
impl Window
[src]
impl Window
pub fn alert(&self, message: &str) | [src] |
The Window.alert() method displays an alert dialog with the optional specified content and an OK button.
pub fn local_storage(&self) -> Storage | [src] |
The local_storage
property allows you to access a local Storage
object.
It is similar to the Window::session_storage.
The only difference is that, while data stored in local_storage
has
no expiration time, data stored in session_storage
gets cleared when
the browsing session ends - that is, when the browser is closed.
pub fn session_storage(&self) -> Storage | [src] |
The session_storage
property allows you to access a session Storage
object for the current origin.
It is similar to the Window::local_storage,
The only difference is that, while data stored in local_storage
has
no expiration time, data stored in session_storage
gets cleared when
the browsing session ends.
A page session lasts for as long as the browser is open and survives over page reloads and restores. Opening a page in a new tab or window will cause a new session to be initiated, which differs from how session cookies work.
pub fn location(&self) -> Option<Location> | [src] |
Returns a Location object which contains information about the URL of the document and provides methods for changing that URL and loading another URL.
pub fn request_animation_frame<F: FnOnce(f64) + 'static>( | [src] |
You should call this method whenever you're ready to update your animation onscreen. This will request that your animation function be called before the browser performs the next repaint. The number of callbacks is usually 60 times per second, but will generally match the display refresh rate in most web browsers as per W3C recommendation. request_animation_frame() calls are paused in most browsers when running in background tabs or hidden iframes in order to improve performance and battery life.
The callback method is passed a single argument, a f64, which indicates the current time when callbacks queued by requestAnimationFrame() begin to fire. Multiple callbacks in a single frame, therefore, each receive the same timestamp even though time has passed during the computation of every previous callback's workload. This timestamp is a decimal number, in milliseconds, but with a minimal precision of 1ms (1000 µs).
pub fn history(&self) -> History | [src] |
Returns the global History object, which provides methods to manipulate the browser history.
pub fn inner_width(&self) -> i32 | [src] |
Returns the width (in pixels) of the browser window viewport including, if rendered, the vertical scrollbar.
pub fn inner_height(&self) -> i32 | [src] |
Returns the height (in pixels) of the browser window viewport including, if rendered, the horizontal scrollbar.
pub fn outer_width(&self) -> i32 | [src] |
Returns the width of the outside of the browser window. It represents the width of the whole browser window including sidebar (if expanded), window chrome and window resizing borders/handles.
pub fn outer_height(&self) -> i32 | [src] |
Returns the height of the outside of the browser window. It represents the height of the whole browser window including sidebar (if expanded), window chrome and window resizing borders/handles.
pub fn page_y_offset(&self) -> f64 | [src] |
The read-only Window property pageYOffset is an alias for scrollY; as such, it returns the number of pixels the document is currently scrolled along the vertical axis (that is, up or down), with a value of 0.0 indicating that the top edge of the Document is currently aligned with the top edge of the window's content area.
pub fn page_x_offset(&self) -> f64 | [src] |
This is an alias for scrollX.
pub fn device_pixel_ratio(&self) -> f64 | [src] |
The ratio in resolution from physical pixels to CSS pixels
pub fn get_selection(&self) -> Option<Selection> | [src] |
Returns a Selection object representing the range of text selected by the user or the current position of the caret. (Javascript docs)
Trait Implementations
impl JsSerialize for Window
[src]
impl JsSerialize for Window
impl TryFrom<EventTarget> for Window
[src]
impl TryFrom<EventTarget> for Window
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: EventTarget) -> Result<Self, Self::Error> | [src] |
impl TryFrom<Window> for Reference
[src]
impl TryFrom<Window> for Reference
type Error = Void
The type returned in the event of a conversion error.
fn try_from(value: Window) -> Result<Self, Self::Error> | [src] |
impl TryFrom<Reference> for Window
[src]
impl TryFrom<Reference> for Window
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: Reference) -> Result<Self, Self::Error> | [src] |
impl<'_r> TryFrom<&'_r Reference> for Window
[src]
impl<'_r> TryFrom<&'_r Reference> for Window
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: &Reference) -> Result<Self, Self::Error> | [src] |
impl TryFrom<Value> for Window
[src]
impl TryFrom<Value> for Window
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: Value) -> Result<Self, Self::Error> | [src] |
impl<'_r> TryFrom<&'_r Value> for Window
[src]
impl<'_r> TryFrom<&'_r Value> for Window
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: &Value) -> Result<Self, Self::Error> | [src] |
impl InstanceOf for Window
[src]
impl InstanceOf for Window
fn instance_of(reference: &Reference) -> bool | [src] |
impl ReferenceType for Window
[src]
impl ReferenceType for Window
unsafe fn from_reference_unchecked(reference: Reference) -> Self | [src] |
impl IEventTarget for Window
[src]
impl IEventTarget for Window
fn add_event_listener<T, F>(&self, listener: F) -> EventListenerHandle where | [src] |
Adds given event handler to the list of event listeners for the specified EventTarget
on which it's called. Read more
fn dispatch_event<T: IEvent>(&self, event: &T) -> Result<bool, TODO> | [src] |
Dispatches an Event
at this EventTarget
, invoking the affected event listeners in the appropriate order. Read more
impl IWindowOrWorker for Window
[src]
impl IWindowOrWorker for Window
fn set_timeout<F: FnOnce() + 'static>(&self, callback: F, timeout: u32) | [src] |
Sets a timer which executes a function once after the timer expires. Read more
impl AsRef<Reference> for Window
[src]
impl AsRef<Reference> for Window
impl Clone for Window
[src]
impl Clone for Window
fn clone(&self) -> Window | [src] |
fn clone_from(&mut self, source: &Self) | 1.0.0 [src] |
Performs copy-assignment from source
. Read more
impl From<Window> for EventTarget
[src]
impl From<Window> for EventTarget
impl From<Window> for Reference
[src]
impl From<Window> for Reference
impl Eq for Window
[src]
impl Eq for Window
impl PartialEq<Window> for Window
[src]
impl PartialEq<Window> for Window
impl Debug for Window
[src]
impl Debug for Window
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |