Fork me on GitHub
#re-frame
<
2018-04-18
>
aleksandr04:04:28

Hello everyone! I have one common key for all my app-db. It looks so:

{:db {:swipe-component {:key1 value
                                               :key2 value
                                               :key3 value}}}
Thus my reg-sub looks like:
(re-frame/reg-sub
  ::transition-end?
  :<- [::swipe-component]
  (fn [swipe-component]
    (:duration swipe-component)))
And It rerun every time when any item in my app-db have changed!

aleksandr04:04:59

Is it correct at all? How can I watch only for the :duration key in the :swipe-component map?

curlyfry07:04:35

@mikethompson Listened to your excellent defn interview, great stuff! 🙂 You mentioned using reagent bindings for Vega, would you care to share which one you're using?

mikethompson07:04:12

We've rolled our own approach but try https://github.com/metasoarous/oz

mikethompson07:04:30

Vega is big and powerful ... and more complicated Vega-Lite is much more approachable for simpler stuff

curlyfry07:04:57

Cool, I like the possibility of using Vega-Lite for your day-to-day visualisations and using Vega for more complex ones

curlyfry07:04:16

What made you roll your own approach rather than using oz?

Desmond07:04:56

does anyone have an example of remote streaming with re-frame? i'm new to the reactive stuff and i'm not sure how to fit it into clojurescript/re-frame

curlyfry07:04:29

@mikethompson Ok, thanks! We've used that doc for adding highcharts components to our app. Vega got me very intrigued though.

mikethompson07:04:42

@curlyfry ^^ will quickly give a sense of Vega-Lite (remember that Vega is more flexible and powerful)

curlyfry07:04:09

Cool, I sort of feel like this is what I've been looking for when it comes to visualisations. I often feel a bit limited by higher level libs, and D3 always felt (while very cool) like too much work and a bit too imperative.

mikethompson07:04:49

Yeah, there's a learning curve. But I feel like we'll be kicking goals with this for years to come.

tord10:04:18

What's the recommended way of doing animation with re-frame? My current approach is to have a (reg-event-fx ::animation-frame ...) that updates the animation state and dispatches to itself until the animation is finished. This works, and performs surprisingly well (even on mobile devices), but feels rather low-level.

lwhorton15:04:36

hey again guys - i’m wondering if it’s possible to pause re_frame’s event execution via js/alert? i thought that alert just freezes literally everything until a user clicks “ok”, but reframe seems to be processing events in the background?

lwhorton15:04:05

nevermind. i think my debugger was screwing up the order of execution. if i just let events flow js/alert does indeed freeze the world

reefersleep12:04:54

I’m curious; what’s your use case for freezing event execution?

lwhorton14:04:53

just logging out a user after X minutes of inactivity. it’s nice to show an alert as to why it happened

reefersleep12:04:40

Cheers 🙂

alex-dixon17:04:15

Is there a way to access the raw response from http-fx? I’ve googled and read some source code as well as supplied rest params to my success and failure handlers…not seeing a way to do this yet

alex-dixon17:04:39

Looks like I should have looked at the underlying library. Should be able to do this with https://github.com/JulianBirch/cljs-ajax/blob/master/docs/formats.md#non-standard-formats

Desmond17:04:27

how can i pass an argument to :first-dispatch?

Desmond17:04:16

appears i can just pass in the same vector

alex-dixon18:04:20

Actually still struggling with accessing response headers from http-fx via cljs-ajax…

alex-dixon18:04:04

I’m able to get the raw Google XHRIO object as documented in the link above, but it doesn’t appear to contain any header information

Desmond18:04:20

@alex-dixon do you know if re-frame-http-fx can stream events to/from a server

alex-dixon18:04:05

I’m not sure but beginning to think maybe Clojurists together could help out cljs-ajax a bit. 🙂

Desmond18:04:03

sounds like a worthwhile pursuit

alex-dixon18:04:09

Or just a new one that uses fetch api. Only concern would be performance

alex-dixon18:04:54

Also compatability with node

Ivan Fedorov19:04:21

Is it feasible at all to use re-frame in a text editing web-app? Are there any cljs implementations of contentEditable-style text editors? Thanks in advance

Ivan Fedorov19:04:29

@raymcdermott sir, I'd be very grateful if you have shared your findings 🙂 Thanks in advance

genRaiy20:04:02

I have only done it with textarea so far, that is next on the list for me

genRaiy20:04:12

so I don’t have anything proper to share

Ivan Fedorov21:04:59

@raymcdermott I'm going to try to integrate draft.js, which is a React project. I can ping you, when I reach success or fail. If you want

javi21:04:08

@ognivo i am using re-frame with codemirror, draftjs... also have used it with prosemirror, substance... it is very easy to setup

javi21:04:31

i will be deploying some stuff as soon as i finish a merge i have been working on

javi21:04:51

interop with reagent is straightforward

[:> Editor-wysiwyg {:editorState         @state

                                                        :wrapperClassName    "demo-wrapper"
                                                        :editorClassName     "demo-editor"
                                                        :onEditorStateChange (fn [content-state] (on-editor-change content-state state entity-id))
                                                        :toolbarOnFocus      true
                                                        :toolbarCustomButtons [(r/as-element [custom-option state])
                                                                                   (r/as-element [insert-image-comp state])]
                                                        :toolbar             {
                                                                              ;:colorPicker {:component (r/reactify-component custom-option)}
                                                                              }
                                                        :hashtag             {}
                                                        :mention             {:separator   " "
                                                                              :trigger     "@"...... ..... 

javi21:04:43

with draft js ended up using this wrapper instead of teh plugin system that is also quite popular https://github.com/nrfm/react-draft-wysiwyg

genRaiy21:04:07

I’m making a REPL and am planning on porting over paten-soup

javi22:04:20

looks cool! I would love to share experiences... i am making a tool to build "interactive systems" from "conceptual models of the system"... i know i need to work on that pitch 🙂 https://drive.google.com/open?id=18U_lVGzGJAf9dZFtuoCTnEzalrkFNEWa https://drive.google.com/open?id=13lcWt9nG_o4OTGr3o-CTY7KvAwE2xREU some old WIP. multiple instances of draftjs, codemirror.... all backed by a rules based system with clara rules...

javi13:04:19

@ognivo i extracted a minimal gist of Draftjs how to use... no re-frame, r/atoms instead but same approach... jsut add events and subs 2 use cases... 1. init with no content 2. init with content https://gist.github.com/nrfm/0c33d297e8ae5cf36c98ef640003a118

đź‘Ť 4
Ivan Fedorov16:04:20

@U9VP9VCE6 whoa, thank you so much mate ❤️🍺

javi16:05:12

@raymcdermott i just watched your talk at DCD... that was great. Made me go into brainstorm mode about the posiblilities of a shared repl.... thanks!

genRaiy19:05:26

thanks @U9VP9VCE6… I’m open to ideas 🙂

danielcompton19:04:11

@ognivo I think @raymcdermott has been looking at that recently

đź‘Ť 4