mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 22:55:48 +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>
35 lines
848 B
Go
35 lines
848 B
Go
package application
|
|
|
|
import (
|
|
"github.com/wailsapp/wails/v3/pkg/errs"
|
|
)
|
|
|
|
const (
|
|
SystemIsDarkMode = 0
|
|
Environment = 1
|
|
Capabilities = 2
|
|
Flags = 3
|
|
)
|
|
|
|
var systemMethodNames = map[int]string{
|
|
SystemIsDarkMode: "IsDarkMode",
|
|
Environment: "Environment",
|
|
Capabilities: "Capabilities",
|
|
Flags: "Flags",
|
|
}
|
|
|
|
func (m *MessageProcessor) processSystemMethod(req *RuntimeRequest) (any, error) {
|
|
switch req.Method {
|
|
case SystemIsDarkMode:
|
|
return globalApplication.Env.IsDarkMode(), nil
|
|
case Environment:
|
|
return globalApplication.Env.Info(), nil
|
|
case Capabilities:
|
|
return globalApplication.capabilities, nil
|
|
case Flags:
|
|
flags := globalApplication.impl.GetFlags(globalApplication.options)
|
|
return flags, nil
|
|
default:
|
|
return nil, errs.NewInvalidSystemCallErrorf("unknown method: %d", req.Method)
|
|
}
|
|
}
|