pub struct WasmWindow(/* private fields */);Implementations§
Source§impl WasmWindow
impl WasmWindow
pub fn document(&self) -> WasmToolkitResult<WasmDocument>
pub fn location(&self) -> Location
Sourcepub fn protocol(&self) -> WasmToolkitResult<String>
pub fn protocol(&self) -> WasmToolkitResult<String>
The protocol property of the URL interface is a string containing the protocol or scheme of the URL, including the final “:”.
This property can be set to change the protocol of the URL. A “:” is appended to the provided string if not provided. The provided scheme has to be compatible with the rest of the URL to be considered valid.
Sourcepub fn port(&self) -> WasmToolkitResult<String>
pub fn port(&self) -> WasmToolkitResult<String>
The port property of the URL interface is a string containing the port number of the URL. If the port is the default for the protocol (80 for ws: and http:, 443 for wss: and https:, and 21 for ftp:), this property contains an empty string, “”.
This property can be set to change the port of the URL. If the URL has no host or its scheme is file:, then setting this property has no effect. It also silently ignores invalid port numbers.
Sourcepub fn hostname(&self) -> WasmToolkitResult<String>
pub fn hostname(&self) -> WasmToolkitResult<String>
The hostname property of the URL interface is a string containing either the domain name or IP address of the URL. If the URL does not have a hostname, this property contains an empty string, “”. IPv4 and IPv6 addresses are normalized, such as stripping leading zeros, and domain names are converted to IDN.
This property can be set to change the hostname of the URL. If the URL’s scheme is not hierarchical (which the URL standard calls “special schemes”), then it has no concept of a host and setting this property has no effect.
§Examples
https://developer.mozilla.org/en-US/docs/Web/API/URL/hostname
Yields: 'developer.mozilla.org
你好.com
Yields: 'xn--6qq79v.comSourcepub fn host(&self) -> WasmToolkitResult<String>
pub fn host(&self) -> WasmToolkitResult<String>
The host property of the URL interface is a string containing the host, which is the hostname, and then, if the port of the URL is nonempty, a “:”, followed by the port of the URL. If the URL does not have a hostname, this property contains an empty string, “”.
This property can be set to change both the hostname and the port of the URL. If the URL’s scheme is not hierarchical (which the URL standard calls “special schemes”), then it has no concept of a host and setting this property has no effect.
Note: If the given value for the host setter lacks a port, the URL’s port will not change. This can be unexpected as the host getter does return a URL-port string, so one might have assumed the setter to always “reset” both.
§Examples
1. https://developer.mozilla.org/en-US/docs/Web/API/URL/host
"developer.mozilla.org"
2. https://developer.mozilla.org:443/en-US/docs/Web/API/URL/host
developer.mozilla.org #The port number is not included because 443 is the scheme's default port
3. https://developer.mozilla.org:4097/en-US/docs/Web/API/URL/host
developer.mozilla.org:4097Sourcepub fn origin(&self) -> WasmToolkitResult<String>
pub fn origin(&self) -> WasmToolkitResult<String>
The origin read-only property of the Location interface returns a string containing the Unicode serialization of the origin of the location’s URL. It contains the scheme as the first part.
The port is only included if it’s not the default for the protocol.
§Example: ‘https://developer.mozilla.org’
Sourcepub fn href(&self) -> WasmToolkitResult<String>
pub fn href(&self) -> WasmToolkitResult<String>
The href property of the Location interface is a stringifier that returns a string containing the whole URL, and allows the href to be updated. Setting the value of href navigates to the provided URL.
If you want redirection, use location.replace(). The difference from setting the href property value is that when using the location.replace() method, after navigating to the given URL, the current page will not be saved in session history — meaning the user won’t be able to use the back button to navigate to it.
§Example
https://developer.mozilla.org/en-US/docs/Web/API/URL/href Yields: https://developer.mozilla.org/en-US/docs/Web/API/URL/href
Sourcepub fn hash(&self) -> WasmToolkitResult<String>
pub fn hash(&self) -> WasmToolkitResult<String>
The hash property of the URL interface is a string containing a “#” followed by the fragment identifier of the URL. If the URL does not have a fragment identifier, this property contains an empty string, “”.
This property can be set to change the fragment identifier of the URL. When setting, a single “#” prefix is added to the provided value, if not already present. Setting it to “” removes the fragment identifier.
The fragment is percent-encoded when setting but not percent-decoded when reading.
pub fn language(&self) -> WasmToolkitResult<String>
Source§impl WasmWindow
impl WasmWindow
pub fn match_media(&self, query: &str) -> WasmToolkitResult<MediaQueryList>
pub fn query_dark_mode(&self) -> WasmToolkitResult<MediaQueryList>
pub fn is_dark_mode(&self) -> WasmToolkitResult<bool>
pub async fn watch_dark_mode(&self) -> WasmToolkitResult<Receiver<bool>>
Source§impl WasmWindow
impl WasmWindow
pub fn new() -> WasmToolkitResult<Self>
pub fn inner(&self) -> &Window
pub fn clone_window(&self) -> Window
Trait Implementations§
Source§impl Clone for WasmWindow
impl Clone for WasmWindow
Source§fn clone(&self) -> WasmWindow
fn clone(&self) -> WasmWindow
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more