mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-09 12:20:09 +08:00

* plugin handler and lifecycle * rebase * remove reflect s * remove Config and NewPlugin from plugin template * Remove plugin manager, generation of plugin interface * implement http handlers for services remove log trim path prefix wails/services * update plugine example * Misc updates * Ported plugins to services, rewritten example * Added fileserver * Update OnStartup and use a context for the application * Rename PathPrefix to Route. Create docs. * Use service config copy. Add Name to Service Options. Improve service generation. * Use service config copy. Add Name to Service Options. Improve service generation. Update README * Remove rogue db * Update changelog.md --------- Co-authored-by: Lea O'Anthony <lea.anthony@gmail.com>
28 lines
512 B
Go
28 lines
512 B
Go
package application
|
|
|
|
import (
|
|
"context"
|
|
"reflect"
|
|
)
|
|
|
|
type ServiceName interface {
|
|
Name() string
|
|
}
|
|
|
|
type ServiceStartup interface {
|
|
OnStartup(ctx context.Context, options ServiceOptions) error
|
|
}
|
|
|
|
type ServiceShutdown interface {
|
|
OnShutdown() error
|
|
}
|
|
|
|
func getServiceName(service any) string {
|
|
// First check it conforms to ServiceName interface
|
|
if serviceName, ok := service.(ServiceName); ok {
|
|
return serviceName.Name()
|
|
}
|
|
// Next, get the name from the type
|
|
return reflect.TypeOf(service).String()
|
|
}
|