I assume the reason that you can't simply register two handlers for the same event is that order of execution then becomes non-deterministic. This can be problematic (and hard to detect!) if you have two handlers for the same event that access the same state. By simply not allowing more than one handler, this isn't something that you can accidentally do. You can, of course, implement this yourself using the techniques from that wiki page, but you have to make a conscious effort to do this, so you can think about ordering. In your case, you said that each handler will access different state, so you don't have this problem, but I guess the authors of re-frame are playing it safe and not making that assumption, so unfortunately you have to jump through a few hoops (luckily its not too hard to do).
On Tue, 29 Mar 2016 at 20:54 Luke Horton <[email protected]> wrote: > Thanks for the link Chris. I've actually read over this wiki link before, > but didn't think about it too hard. I was hoping I wouldn't have to make > drastic changes to the infrastructure to handle my particular use, but it > seems that might be the case. If I'm going to essentially write my own > messaging bus that handles dynamic subscriptions and many to many handlers, > I should probably just not bother with re-frame. The other quirk that kind > of bothers me is how each handler defines its own middleware. I tend to > think of middleware as an application-wide orthogonal offering for logging, > debugging, reporting, etc. I don't like the idea of having to manually > insert middleware for each and every handler, even if I generate a > middleware factory. > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/clojurescript. > -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/clojurescript.
