5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 19:51:15 +08:00
wails/v3/examples/plugins/plugins/hashes
Lea Anthony 5949e305ea
Reorder startup sequence
Add plugin scripts to asset server
Add InjectJS support in plugins
2023-03-24 08:43:00 +11:00
..
hashes.d.ts Add plugin init. Update plugin signature. 2023-03-19 09:13:05 +11:00
hashes.js Add plugin init. Update plugin signature. 2023-03-19 09:13:05 +11:00
plugin.go Reorder startup sequence 2023-03-24 08:43:00 +11:00
plugin.toml Add plugin init. Update plugin signature. 2023-03-19 09:13:05 +11:00
README.md Add plugin init. Update plugin signature. 2023-03-19 09:13:05 +11:00

Hashes Plugin

This example plugin provides a way to generate hashes of strings.

Usage

Add the plugin to the Plugins option in the Applications options:

    Plugins: map[string]application.Plugin{
        "hashes": hashes.NewPlugin(),
    },

You can then call the Generate method from the frontend:

    wails.Plugin("hashes","Generate","hello world").then((result) => console.log(result))

This method returns a struct with the following fields:

    interface Hashes {
        md5: string;
        sha1: string;
        sha256: string;
    }

A TypeScript definition file is provided for this interface.