add state as second arg for eventListenerCallback

This commit is contained in:
Sam Lewis
2022-11-08 22:48:34 -05:00
parent 5afa301f36
commit 1ec5878ff9
4 changed files with 14 additions and 4 deletions

View File

@@ -22,7 +22,7 @@ type EventListener struct {
}
// TODO: add state object as second arg
type EventListenerCallback func(*Service, EventData)
type EventListenerCallback func(*Service, *State, EventData)
type EventData struct {
Type string
@@ -130,7 +130,7 @@ func callEventListeners(app *App, msg ws.ChanMsg) {
Type: baseEventMsg.Event.EventType,
RawEventJSON: msg.Raw,
}
go l.callback(app.service, eventData)
go l.callback(app.service, app.state, eventData)
l.lastRan = carbon.Now()
}
}