On Tuesday, November 22, 2016 at 4:59:22 AM UTC, Gusztáv Szikszai wrote: > > I think you are looking for something like this: > https://github.com/gdotdesign/elm-ui/blob/master/source/Ui/Helpers/Emitter.elm > > It's a pure Elm pub / sub effects module (and possibly the most minimal > example of an effect module). >
Yes, that is perfect for my use case, thanks. This should be added to the official packages? I was wondering, would it be possible to make a send/listen pair where the type of the item being transmitted is variable? For example, the send/listen pair for a Json Value is: send : String -> Value -> Cmd msg listen : String -> (Value -> msg) -> Sub msg But given there is no native code at all, why translate to json? It seems unnecessary. Instead I want a constructor for the send/listen pair: mailbox : String -> (a -> Cmd msg, (a -> msg) -> Sub msg) That is, I provide the name of the channel and it returns a send/listen pair that operate on type 'a'. Or perhaps it is just: send : String -> a -> Cmd msg listen : String -> (a -> msg) -> Sub msg Is there some reason this cannot be done? -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
