Keep track of a stream of events and set triggers that send out outgoing events.
Currently in use by us to supply the Google Tag Managers Data Layer with safely encoded events.
The EventStream holds the possible eventNames and matchers, triggers for outgoing events and ofcourse every past events
init : List ( String, IncomingEventMatcher ) -> List ( Matcher, OutgoingEventDecoder ) -> EventStream
Create an EventStream
addEvent : RawIncomingEvent -> EventStream -> Result Error ( EventStream, List RawOutgoingEvent )
Attempt to add a new event to the EventStream
The minimal expected structure of an event needs to look like;
{ "eventName": "YourEventName",
"eventData": "Data for which you supply a decoder that confirms it's validity and match"
}
getEvents : Matcher -> EventStream -> List RawIncomingEvent
Get RawIncomingEvents that match query from the eventStream
addTrigger : Matcher -> OutgoingEventDecoder -> EventStream -> EventStream
Add a trigger to the EventStream
A structured error describing why your mutation to the EventStream failed. You can use this to give feedback to the developer who might be adding an unknown or misformed event.
errorToString : Error -> String
Convert an EventStream error into a String that is nice for debugging.
String
The Matcher is currently an alias for the Core String type.
The Matcher allows for more advanced, event specific triggers to be set.
You might have an event A that contains a field name
on which you want to place a specific trigger.
This could then look like A.someValue
.
Please refer to the tests included for more examples