5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 17:09:23 +08:00
wails/v3/plugins
2023-03-21 08:55:55 +11:00
..
browser Add Exported() []string to plugin API 2023-03-21 08:55:55 +11:00
kvstore Add Exported() []string to plugin API 2023-03-21 08:55:55 +11:00
README.md Add Exported() []string to plugin API 2023-03-21 08:55:55 +11:00

Plugins

Plugins are a way to extend the functionality of your Wails application.

Creating a plugin

Plugins are standard Go structure that adhere to the following interface:

type Plugin interface {
    Name() string
    Init(*application.App) error
    Shutdown() 
    Exported() []string
}

The Name() method returns the name of the plugin. This is used for logging purposes.

The Init(*application.App) error method is called when the plugin is loaded. The *application.App parameter is the application that the plugin is being loaded into. Any errors will prevent the application from starting.

The Shutdown() method is called when the application is shutting down.

The Exported() method returns a list of exported functions that can be called from the frontend. These method names must exactly match the names of the methods exported by the plugin.