Documentation ¶
Index ¶
- Variables
- func AddEvent(event *Event) error
- func Register(trigger Core)
- func RemoveEvent(event *Event)
- type Base
- type Core
- type Event
- func (e *Event) GenerateUUDI()
- func (e *Event) ID() string
- func (e *Event) Start() error
- func (e *Event) Stop() error
- func (e *Event) Subscribe(task types.Runnable) error
- func (e *Event) Trigger()
- func (e *Event) UnmarshalJSON(data []byte) error
- func (e *Event) Unsubscribe(task types.Runnable) error
- func (e *Event) Validate() error
- type Proxy
Constants ¶
This section is empty.
Variables ¶
var Events map[string]*Event
Events contains the registered events in the application
var Templates map[string]*Event
Templates containes sample events as a preview to the user
Functions ¶
func RemoveEvent ¶
func RemoveEvent(event *Event)
RemoveEvent removes an evenet from the application
Types ¶
type Base ¶
type Base struct {
types.Triggerable `json:"-"`
}
Base is a struct used for subtyping to implement different events for the application
func (*Base) Bind ¶
func (b *Base) Bind(event types.Triggerable)
Bind bind the trigger to the eventable
type Core ¶
type Core interface { types.Triggerable Bind(e types.Triggerable) Describe() string }
Core is an interfaces which is the trigger mechanism for an event
type Event ¶
type Event struct { subject.Subject style.Style *sync.Mutex Core `json:"-"` Observers []types.Runnable `json:"-"` UUID string `json:"uuid"` Desc string `json:"description"` Running bool `json:"running"` // contains filtered or unexported fields }
Event is a type which is used to trigger tasks
func GetEventByID ¶
GetEventByID returns the event given by the id
func (*Event) GenerateUUDI ¶
func (e *Event) GenerateUUDI()
GenerateUUDI creates a new UUID for the event
func (*Event) UnmarshalJSON ¶
UnmarshalJSON serialized an event fron json encoding
func (*Event) Unsubscribe ¶
Unsubscribe removes a task from this events observables
type Proxy ¶
type Proxy struct {
*Event
}
Proxy is a eventable object with custom json mashal/unmarshal methods
func (*Proxy) MarshalJSON ¶
MarshalJSON return the UUID of the event
func (*Proxy) UnmarshalJSON ¶
UnmarshalJSON returns the event specified by it's id