Struct tauri_runtime::webview::WebviewAttributes [−][src]
pub struct WebviewAttributes {
pub url: WindowUrl,
pub initialization_scripts: Vec<String>,
pub data_directory: Option<PathBuf>,
pub uri_scheme_protocols: HashMap<String, Box<dyn Fn(&str) -> Result<Vec<u8>, Box<dyn Error>> + Send + Sync + 'static>>,
}Expand description
The attributes used to create an webview.
Fields
url: WindowUrlinitialization_scripts: Vec<String>data_directory: Option<PathBuf>uri_scheme_protocols: HashMap<String, Box<dyn Fn(&str) -> Result<Vec<u8>, Box<dyn Error>> + Send + Sync + 'static>>Implementations
impl WebviewAttributes[src]
impl WebviewAttributes[src]pub fn initialization_script(self, script: &str) -> Self[src]
pub fn initialization_script(self, script: &str) -> Self[src]Sets the init script.
pub fn data_directory(self, data_directory: PathBuf) -> Self[src]
pub fn data_directory(self, data_directory: PathBuf) -> Self[src]Data directory for the webview.
pub fn has_uri_scheme_protocol(&self, name: &str) -> bool[src]
pub fn has_uri_scheme_protocol(&self, name: &str) -> bool[src]Whether the webview URI scheme protocol is defined or not.
pub fn register_uri_scheme_protocol<N: Into<String>, H: Fn(&str) -> Result<Vec<u8>, Box<dyn Error>> + Send + Sync + 'static>(
self,
uri_scheme: N,
protocol: H
) -> Self[src]
pub fn register_uri_scheme_protocol<N: Into<String>, H: Fn(&str) -> Result<Vec<u8>, Box<dyn Error>> + Send + Sync + 'static>(
self,
uri_scheme: N,
protocol: H
) -> Self[src]Registers a webview protocol handler. Leverages setURLSchemeHandler on macOS, AddWebResourceRequestedFilter on Windows and webkit-web-context-register-uri-scheme on Linux.
Arguments
uri_schemeThe URI scheme to register, such asexample.protocolthe protocol associated with the given URI scheme. It’s a function that takes an URL such asexample://localhost/asset.css.