mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 18:42:23 +08:00
18 lines
335 B
Go
18 lines
335 B
Go
package servicebus
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
"runtime"
|
|
)
|
|
|
|
func ExtractBus(ctx context.Context) *ServiceBus {
|
|
bus := ctx.Value("bus")
|
|
if bus == nil {
|
|
pc, _, _, _ := runtime.Caller(1)
|
|
funcName := runtime.FuncForPC(pc).Name()
|
|
log.Fatalf("cannot call '%s': Application not initialised", funcName)
|
|
}
|
|
return bus.(*ServiceBus)
|
|
}
|