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 on_event(&mut self, app: &AppHandle<R>, event: &RunEvent) { ... } fn extend_api(&mut self, invoke: Invoke<R>) { ... } }
Expand description

The plugin interface.

Required Methods

The plugin name. Used as key on the plugin config object.

Provided Methods

Initializes the plugin.

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.

Callback invoked when the webview is created.

Callback invoked when the webview performs a navigation to a page.

Callback invoked when the event loop receives a new event.

Extend commands to crate::Builder::invoke_handler.

Implementors