Trait tauri::plugin::Plugin [−][src]
pub trait Plugin<P: Params>: Send { fn name(&self) -> &'static str; fn initialize(&mut self, app: &App<P>, config: JsonValue) -> Result<()> { ... } fn initialization_script(&self) -> Option<String> { ... } fn created(&mut self, window: Window<P>) { ... } fn on_page_load(&mut self, window: Window<P>, payload: PageLoadPayload) { ... } fn extend_api(&mut self, invoke: Invoke<P>) { ... } }
Expand description
The plugin interface.
Required methods
Provided methods
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<P>, payload: PageLoadPayload)
fn on_page_load(&mut self, window: Window<P>, payload: PageLoadPayload)
Callback invoked when the webview performs a navigation.
fn extend_api(&mut self, invoke: Invoke<P>)
fn extend_api(&mut self, invoke: Invoke<P>)
Add invoke_handler API extension commands.