func NewEventHandler() *EventHandler {
	return &EventHandler{
		cs: make(map[interface{}]map[string]map[int]EventCallback),
		m:  &sync.Mutex{},
	}
}
NewEventHandler creates a new event handler
package astiencoder
import (
	"fmt"
	"sort"
	"sync"
	"github.com/asticode/go-astikit"
)
var (
	EventNameError             = "astiencoder.error"
	EventNameNodeContinued     = "astiencoder.node.continued"
	EventNameNodePaused        = "astiencoder.node.paused"
	EventNameNodeStarted       = "astiencoder.node.started"
	EventNameNodeStopped       = "astiencoder.node.stopped"
	EventNameStats             = "astiencoder.stats"
	EventNameWorkflowContinued = "astiencoder.workflow.continued"
	EventNameWorkflowPaused    = "astiencoder.workflow.paused"
	EventNameWorkflowStarted   = "astiencoder.workflow.started"
	EventNameWorkflowStopped   = "astiencoder.workflow.stopped"
	EventTypeContinued         = "continued"
	EventTypePaused            = "paused"
	EventTypeStarted           = "started"
	EventTypeStopped           = "stopped"
)
type Event struct {
	Name    string
	Payload interface{}
	Target  interface{}
}
func EventError(target interface{}, err error) Event {
	return Event{
		Name:    EventNameError,
		Payload: err,
		Target:  target,
	}
}
type EventHandler struct {
	cs  map[interface{}]map[string]map[int]EventCallback
	idx int
	m   *sync.Mutex
}
type EventCallback func(e Event) (deleteListener bool)