I’m experimenting with a new approach to bridging Elm and React Native / Expo. I have some basic rendering working, but now I need to add events handling, especially touch events. I want to build on Dom.LowLevel.onDocument, with an API resembling the Mouse package. The low-level JS handling of the stuff I know how to do (I’ll be intercepting document.addEventListener() calls), but I’m having trouble with the Elm side — how should I write an Effect Manager module? I started reading the Mouse package and trying to understand it, but it showed up to be much more complex than I expected, and I’m getting lost
especially once I saw the effect module Mouse preamble on the first line, I realized that’s something different than the usual stuff…
Could someone please help me?
Ideally, I’d like to have an API like follows, for the first low-level prototype implementation of the package:
touchEvents : Json.Decode.Decoder msg -> Sub msg
How should I start to approach writing such a module? How could I write even a simplest possible kind of an effects subscriptions module?
Or, alternatively, could you explain to me how the Mouse module works, so that I could copy what I need from it?