Trait tauri::plugin::Plugin
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 methodsname(&self) -> &'static str[src]#
fnThe plugin name. Used as key on the plugin config object.
#
Provided methodsinitialize(&mut self, app: &AppHandle<R>, config: JsonValue) -> Result<()>[src]#
fnInitializes the plugin.
initialization_script(&self) -> Option<String>[src]#
fnThe 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.
created(&mut self, window: Window<R>)[src]#
fnCallback invoked when the webview is created.
on_page_load(&mut self, window: Window<R>, payload: PageLoadPayload)[src]#
fnCallback invoked when the webview performs a navigation to a page.
extend_api(&mut self, invoke: Invoke<R>)[src]#
fnExtend commands to crate::Builder::invoke_handler
.