Fork me on GitHub
#re-frame
<
2017-10-02
>
lumpy13:10:30

any thoughts on adding docs to event handlers and subs?

lumpy13:10:53

is it possible and I’m missing something

yury.solovyov15:10:10

there are some in the sources, I think

lumpy16:10:07

I meant like being able to add doc strings to an event or sub.

colindresj15:10:00

I found that just breaking out the registration from the handler function has many benefits, including the ability to add a docstring

colindresj15:10:15

So,

(defn my-fun
  "my-doc"
  []
  …)

(reg-event-db my-fun)

lumpy18:10:04

thanks, this is what I ended up doing, makes stuff much easier to maintain

rgm18:10:25

having a bit of trouble phrasing this question right ... I have an [initialize-db] fx-event that fires an xhr request to nab some CSV. It needs a URL. This is easy when it's just local, as /csv/my.csv will work fine. But when I'm mounted at a different root on Tomcat, it needs to be /my-war-file/csv/my.csv, and it seems like just csv/my.csv doesn't work. Can anyone tell me the normal-ish way to deal with this?

rgm18:10:58

(bit more detail ... I've just got the CSV as static resources under resources/public/csv in my source tree).

rgm18:10:23

my ring handler seems OK since a curl for the CSV against the tomcat server succeeds.