MattCheely / tryframe-coordinator / Message.Toast

Requesting the host application to show a notification of some sort is a common use case for cross-frame messaging. The Message.Toast module defines types to support this use case.


type alias Toast =
{ title : Maybe String
, message : String
, custom : Maybe Json.Decode.Value 
}

The Toast type represents a request from a client to a host to display a notification. It consists of an optional title, a message to display and a placeholder for custom pass-through data to support additional app-specific features. Common use cases for app-specific features are things like timed auto-dismissal, notification levels or icons, etc.

encode : Toast -> Json.Encode.Value

Encodes a Toast to JSON, tagging it with label

decoder : Json.Decode.Decoder Toast

Decoder for Toast messages, which are expected to be tagged with label

label : String

This is the label used to tag toast requests in JSON. Other modules should not need to reference it, but it is exposed to force a package version bump if it changes.