Function init

Source
pub fn init(py_invoke_handler: PyObject) -> TauriPlugin<Runtime>
Expand description

Initializes the plugin.

The py_invoke_handler should have the following signature:

def py_invoke_handler(invoke: Invoke, /) -> None: …

It will be stored in the tauri app state and used to handle ipc requests from the frontend. You can get its reference through PyInvokeHandlerExt.

§NOTE:

  • py_invoke_handler will be called in a tokio runtime, so it must not block for a long time.
    • tokio runtime means it is running on an external thread.
  • py_invoke_handler must not raise exceptions, otherwise it will result in logical undefined behavior.