Trait tauri::plugin::Plugin [−][src]
pub trait Plugin<R: Runtime>: Send { fn name(&self) -> &'static str; fn initialize(
&mut self,
app: &AppHandle<R>,
config: JsonValue
) -> Result<()> { ... } fn initialization_script(&self) -> Option<String> { ... } fn created(&mut self, window: Window<R>) { ... } fn on_page_load(&mut self, window: Window<R>, payload: PageLoadPayload) { ... } fn extend_api(&mut self, invoke: Invoke<R>) { ... } }
Expand description
The plugin interface.
Required methods
Provided methods
Initializes the plugin.
fn initialization_script(&self) -> Option<String>
fn initialization_script(&self) -> Option<String>
The JS script to evaluate on webview initialization.
The script is wrapped into its own context with (function () { /* your script here */ })();
,
so global variables must be assigned to window
instead of implicity declared.
It’s guaranteed that this script is executed before the page is loaded.
fn on_page_load(&mut self, window: Window<R>, payload: PageLoadPayload)
fn on_page_load(&mut self, window: Window<R>, payload: PageLoadPayload)
Callback invoked when the webview performs a navigation to a page.
fn extend_api(&mut self, invoke: Invoke<R>)
fn extend_api(&mut self, invoke: Invoke<R>)
Extend commands to crate::Builder::invoke_handler
.