Documentation ¶
Index ¶
- Variables
- type Closure
- type Event
- func (e *Event[T]) Attach(closure *Closure[T], triggerMaxCount ...uint64)
- func (e *Event[T]) Detach(closure *Closure[T])
- func (e *Event[T]) DetachAll()
- func (e *Event[T]) Hook(closure *Closure[T], triggerMaxCount ...uint64)
- func (e *Event[T]) HookAfter(closure *Closure[T], triggerMaxCount ...uint64)
- func (e *Event[T]) HookBefore(closure *Closure[T], triggerMaxCount ...uint64)
- func (e *Event[T]) Trigger(event T)
Constants ¶
This section is empty.
Variables ¶
var Loop *workerpool.BlockingQueuedWorkerPool
Functions ¶
This section is empty.
Types ¶
type Closure ¶
Closure represents function reference uniquely.
func NewClosure ¶
NewClosure creates a new Closure
type Event ¶
type Event[T any] struct { // contains filtered or unexported fields }
Event represents an object that is triggered to notify code of "interesting updates" that may affect its behavior.
func (*Event[T]) Attach ¶
Attach allows to register a Closure that is executed asynchronously when the Event triggers. If 'triggerMaxCount' is >0, the Closure is automatically detached after exceeding the trigger limit.
func (*Event[T]) DetachAll ¶
func (e *Event[T]) DetachAll()
DetachAll removes all registered callbacks.
func (*Event[T]) Hook ¶
Hook allows to register a Closure that is executed when the Event triggers. If 'triggerMaxCount' is >0, the Closure is automatically detached after exceeding the trigger limit.
func (*Event[T]) HookAfter ¶
HookAfter allows to register a Closure that is executed after the Event triggered. If 'triggerMaxCount' is >0, the Closure is automatically detached after exceeding the trigger limit.
func (*Event[T]) HookBefore ¶
HookBefore allows to register a Closure that is executed before the Event triggers. If 'triggerMaxCount' is >0, the Closure is automatically detached after exceeding the trigger limit.