mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
* custom transport initial * transport codecs * runtime set transport * events transport * clauded example * bundled runtime * wip: transport * rework transports * rework dialog responses * cleanup * cleanup * improve error handling in HTTPTransport * cleanup * cleanup * cleanup * cleanup * review changes * review changes * review changes * review changes * review changes * review changes * review changes * move documentation to website docs * update doc * update changelog * introduce JSClient method for transport for embedding JS part in transport --------- Co-authored-by: Atterpac <Capretta.Michael@gmail.com> Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
37 lines
800 B
Go
37 lines
800 B
Go
package application
|
|
|
|
import (
|
|
"github.com/wailsapp/wails/v3/pkg/errs"
|
|
)
|
|
|
|
const (
|
|
ClipboardSetText = 0
|
|
ClipboardText = 1
|
|
)
|
|
|
|
var clipboardMethods = map[int]string{
|
|
ClipboardSetText: "SetText",
|
|
ClipboardText: "Text",
|
|
}
|
|
|
|
func (m *MessageProcessor) processClipboardMethod(req *RuntimeRequest) (any, error) {
|
|
args := req.Args.AsMap()
|
|
|
|
var text string
|
|
|
|
switch req.Method {
|
|
case ClipboardSetText:
|
|
textp := args.String("text")
|
|
if textp == nil {
|
|
return nil, errs.NewInvalidClipboardCallErrorf("missing argument 'text'")
|
|
}
|
|
text = *textp
|
|
globalApplication.Clipboard.SetText(text)
|
|
return unit, nil
|
|
case ClipboardText:
|
|
text, _ = globalApplication.Clipboard.Text()
|
|
return text, nil
|
|
default:
|
|
return nil, errs.NewInvalidClipboardCallErrorf("unknown method: %d", req.Method)
|
|
}
|
|
}
|