tricycle/elm-eventstream/1.1.0

NOTE: the latest version is 1.1.1

Renamed to bellroy/elm-eventstream. It is published under that name, and new versions come out there.

Versions published as tricycle/elm-eventstream still install under that name. 2 versions of 3 come from the new location (see their notes). 1 version could not be recovered and cannot be installed.

Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/bellroy/elm-eventstream exists but has no tag 1.1.0; Software Heritage not asked yet (this run's --swh-calls were used up); no fork with tag 1.1.0 found (1 same-name repos checked); no cached copy. Use another version.

Details

EventStream

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

The EventStream holds the possible eventNames and matchers, triggers for outgoing events and ofcourse every past events

List ( String, IncomingEventMatcher )
-> List ( Matcher, OutgoingEventDecoder )

Create an EventStream

Events

RawIncomingEvent
-> 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

triggers

addTrigger : Matcher -> OutgoingEventDecoder -> EventStream -> EventStream

Add a trigger to the EventStream

Errors

type Error

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.

Primitives

type alias Matcher =
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