Closed JulianBirch closed 10 years ago
By channel, do you mean core.async? My only concern is that you then force a dependency on core.async. I think this is simple enough and can be application-specific:
(defn listen-chan! [node event-type]
(let [c (chan)]
(dommy/listen! node event-type #(put! c %))
c))
I do, but my understanding is that any dependency on core.async would be stripped out by advanced optimizations anyway.
listen-chan! could either set up a listen that writes to a provided channel, or create the channel itself. The latter is more convenient in the usual case, the former is more desirable in the general case.