-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
30 lines (24 loc) · 794 Bytes
/
types.go
File metadata and controls
30 lines (24 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package dispatch
import "encoding/json"
// EventMessage describes all information of an specific event
type EventMessage struct {
Namespace string
Action string
Type string
Data json.RawMessage
}
// EventHandleFunc defines the signature of event-callback functions
type EventHandleFunc func(EventMessage)
// EventLoopFun defines the signature of an EventLoop-Handling function for custom loop handling
type EventLoopFun func(PackageDescription, chan EventMessage)
// ActionDescription defines one event-action
type ActionDescription struct {
Namespace string
Action string
Callback EventHandleFunc
}
// PackageDescription describes a "thing" that can handle and emit events
type PackageDescription struct {
Actions []ActionDescription
EventLoop EventLoopFun
}