5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 16:02:07 +08:00
wails/v3/plugins
2023-03-22 20:56:45 +11:00
..
browser Exported() -> CallableByJS() 2023-03-22 20:42:20 +11:00
kvstore Exported() -> CallableByJS() 2023-03-22 20:42:20 +11:00
log Simple logging plugin 2023-03-22 20:56:45 +11:00
README.md Exported() -> CallableByJS() 2023-03-22 20:42:20 +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() 
    CallableByJS() []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 CallableByJS() 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.