Fork me on GitHub
#re-frame
<
2018-03-30
>
danielcompton00:03:14

Probably there are JS APIs for that?

danielcompton00:03:27

Not quite sure what you meant there

raymcdermott07:03:29

after some more research the HTML textarea object exposes the needed data and @sekao has a library called cross-parinfer and some dom functions in paren-soup that meet my needs

lumpy12:03:37

Anyone have opinions on view components that generate their own subs and events. We are starting to build more complicated components, like paginated table, and have a lot of similar views and events for each one. We were able to write code that bundles this all into a single view component so you don’t have to manually create all the subs and events. The problem is that all the reg-sub and reg-events fire every time the component is redrawn. That doesn’t seem like a big deal but wanted to get others feedback.

lumpy13:03:05

I understand this leads to the convention vs configuration debate, but would like to stay out of those waters. Really my question is: have people done any auto generation of subs and events and are there ways to prevent the re-registering

nenadalm14:03:57

Hi. I did no such thing. What I am using though is events and subs which are registered just once - but they accept some sort of id as their argument. Data of the component is then stored under the id in app-db. So If I understand you correctly, you're generating subs like :user-grid-page-data, :company-grid-page-data... I have only 1 sub :grid-page-data which accepts id parameter (`user`, company ...). Same for events. Example can be seen here: https://github.com/nenadalm/learning-reactjs/blob/master/re-frame/src/app/views.cljs#L7 where I have 2 different counters (one is shown twice). Both counters use single event: https://github.com/nenadalm/learning-reactjs/blob/master/re-frame/src/app/components/counter/events.cljs#L5.

msuess17:03:51

hi there! I have a project were I would like to send tracking events to an analytics provider. I am currently using add-post-event-callback but it doesn't fit the bill 100% since the callback requires a handle on app-db. do you guys know of a way to do this without using globals or how are people solving this today?

mikerod18:03:47

@msuess what do you require the app-db for I’m wondering

msuess18:03:30

@mikerod we're storing an online flag in there that indicates whether or not the app is connected to the internet. if there is no connection, the tracking events need to be stored to be submitted at a later time.

mikerod18:03:36

@msuess that’s interesting. I wonder if you should use a custom intercepter that you include in your interceptor chain on all of your event handlers

msuess23:03:29

I'll look into that, thanks for the advice @mikerod!

👍 4