Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionHook ¶
type ActionHook struct {
// contains filtered or unexported fields
}
func (*ActionHook) Tap ¶
func (h *ActionHook) Tap(_ string, fn FuncSimpleWithWidgetAndError)
Tap invoked by client to enable registration of the hook
type Activity ¶
Activity represents an entity that performs an action that is tapable. The type F should be a function signature, defined by the tapable, so F is not really any, but it can't be enforced to be a func, so do not try to instantiate with a type that is not a func. To enable a client to augment the core action, Tap returns a func of type F which represents the core behaviour. If required, the client should store this and then invoke it as appropriate when it is called back.
type ActivityL ¶
ActivityL represents an entity that performs an action that is tapable. The type F should be a function signature, defined by the tapable, so F is not really any, but it can't be enforced to be a func, so do not try to instantiate with a type that is not a func. To enable a client to augment the core action, Tap returns a func of type F which represents the core behaviour. If required, the client should store this and then invoke it as appropriate when it is called back.
type AlreadyTappedError ¶
type AlreadyTappedError[R constraints.Integer] struct { // contains filtered or unexported fields }
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
Component contains tapable behaviour
type Container ¶
type Container[R constraints.Integer] struct { // contains filtered or unexported fields }
Container manages a collection of hooks defined for different roles. Since the hook is role specific, there is no way
func NewContainer ¶
func NewContainer[R constraints.Integer]() *Container[R]
NewContainer creates a new instance of a hook container
type FuncSimpleWithWidgetAndError ¶
FuncSimpleWithWidgetAndError is the action func; invoke this function that can be hooked/tapable. In fact, this function can either enable core functionality to be overridden, decorated with auxiliary behaviour or simply as a life-cycle event; ie we have come to a significant point in the component's workflow and the some external entity's function needs to be invoked.
type HooksCollection ¶
type HooksCollection[R constraints.Integer] map[R]HookName
type NotificationHook ¶
type NotificationHook struct {
// contains filtered or unexported fields
}
func (*NotificationHook) On ¶
func (h *NotificationHook) On(_ string, fn FuncSimpleWithWidgetAndError)
Tap invoked by client to enable registration of the hook
type NotifyL ¶
type NotifyL[F any, E constraints.Integer] interface { On(name string, event E, handler F) error }
NotifyL used for life cycle events. There can be multiple subscribers to life cycle events
type Receiver ¶
type Receiver struct {
// contains filtered or unexported fields
}
Receiver contains tapable behaviour received as a notification
type Role ¶
type Role[F any, R constraints.Integer] interface { Tap(name string, role R, fn F) (F, error) }
Role is similar to Activity, but it allows the tapable entity to request that the client specify which specific behaviour needs to be tapped. This is useful when the entity has multiple behaviours that clients may wish to tap. To enable a client to augment the core action, Tap returns a func of type F which represents the core behaviour. If required, the client should store this and then invoke it as appropriate when it is called back.
type RoleL ¶
type RoleL[F any, E constraints.Integer] interface { Tap(name string, role E, fn F) error }
RoleL is similar to Activity, but it allows the tapable entity to request that the client specify which specific behaviour needs to be tapped. This is useful when the entity has multiple behaviours that clients may wish to tap.
type TapContainer ¶
type TapContainer[R constraints.Integer] interface { Tap(name string, role R) error }
type WithDefault ¶
type WithDefault[F any, R constraints.Integer] struct { Name HookName Role R Action F Default F Container *Container[R] }
WithDefault is a helper that binds together a Hook and its associated default action. The default is the pure, non-tapable underlying function.