dynamo-browse/internal/common/ui/uimodels/context.go
Leon Mika 7526c095ee sqs-browse: a lot of work to try to keep UI complexity down
Added the notion of controllers and a dispatcher which will queue up operations
2022-03-23 15:40:31 +11:00

16 lines
350 B
Go

package uimodels
import "context"
type uiContextKeyType struct {}
var uiContextKey = uiContextKeyType{}
func Ctx(ctx context.Context) UIContext {
uiCtx, _ := ctx.Value(uiContextKey).(UIContext)
return uiCtx
}
func WithContext(ctx context.Context, uiContext UIContext) context.Context {
return context.WithValue(ctx, uiContextKey, uiContext)
}