Documentation
¶
Index ¶
- type Application
- func (app *Application) Dispatch(evt any, args ...[]event.Arg) event.Result
- func (app *Application) GetEvents() map[event.Event][]event.Listenerdeprecated
- func (app *Application) Job(e event.Event, args []event.Arg) event.Taskdeprecated
- func (app *Application) Listen(events any, listeners ...any) error
- func (app *Application) Register(events map[event.Event][]event.Listener)deprecated
- type Result
- type ServiceProvider
- type Task
- type TestCancelEvent
- type TestEvent
- type TestEventHandleError
- type TestEventNoRegister
- type TestListener
- type TestListenerHandleError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
func NewApplication ¶
func NewApplication(queue contractsqueue.Queue) *Application
func (*Application) Dispatch ¶
Dispatch fires an event and calls all the listeners registered for it, both the ones registered on the event itself and the ones registered on a matching wildcard pattern. Every listener runs, the returned result carries the errors of the ones that failed.
func (*Application) Job
deprecated
Job creates a new event task.
The task now reaches every listener of the event, including the ones registered through Listen and the ones registered on a matching wildcard pattern. It used to look the listeners up by the identity of the event value, so passing a fresh instance only found them for zero size structs.
Deprecated: Use Dispatch instead, Job will be removed in a future version.
func (*Application) Listen ¶
func (app *Application) Listen(events any, listeners ...any) error
Listen registers one or more listeners for one or more events, see event.Instance for the accepted event and listener forms.
func (*Application) Register
deprecated
func (app *Application) Register(events map[event.Event][]event.Listener)
Register registers events and their listeners, the listeners are also registered on the Listen flow so that Dispatch can reach them.
Deprecated: Use Listen instead, Register will be removed in a future version.
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result collects the errors returned by the listeners of a single dispatch.
type ServiceProvider ¶
type ServiceProvider struct {
}
func (*ServiceProvider) Boot ¶
func (r *ServiceProvider) Boot(app foundation.Application)
func (*ServiceProvider) Register ¶
func (r *ServiceProvider) Register(app foundation.Application)
func (*ServiceProvider) Relationship ¶
func (r *ServiceProvider) Relationship() binding.Relationship
type TestCancelEvent ¶
type TestCancelEvent struct{}
type TestEventHandleError ¶
type TestEventHandleError struct{}
type TestEventNoRegister ¶
type TestEventNoRegister struct{}
type TestListener ¶
type TestListener struct{}
func (*TestListener) Handle ¶
func (receiver *TestListener) Handle(eventName string, args ...any) error
func (*TestListener) Signature ¶
func (receiver *TestListener) Signature() string
type TestListenerHandleError ¶
type TestListenerHandleError struct{}
func (*TestListenerHandleError) Handle ¶
func (receiver *TestListenerHandleError) Handle(eventName string, args ...any) error
func (*TestListenerHandleError) Queue ¶
func (receiver *TestListenerHandleError) Queue(args ...any) event.Queue
func (*TestListenerHandleError) Signature ¶
func (receiver *TestListenerHandleError) Signature() string