Fork me on GitHub
#clojurescript
<
2017-02-14
>
arnaud_bos00:02:22

gut-feeling/top of my head/no evidence based suggestions: vue.js or cycle.js maybe?

rafaelzlisboa00:02:41

yeah i’m basically between writing some procedural clojurescript or running to a js lib vue’s approach seems to be similar to react’s (in which you write a bunch of css classes and it coordinates adding/removing them at the appropriate lifecycle moment of the component), while cycle.js has a tween thing that’s similar to reanimated (probably doesn’t benefit from hardware acceleration but gives more flexibility)

verma01:02:12

@rafaelzlisboa I’ve been working on a reagent project, I have to admit its not very animation-heavy .. but react’s css transition group has been treating me alright

verma01:02:07

I had to actually take a somewhat serious look at it and see if it solves my problem, I wasn’t disappointed

dvingo02:02:07

in Om code i've just used transacts and/or setState calls to make things animate because it has a render loop built in. as long as you're only changing properties that are rendered by the gpu (https://www.html5rocks.com/en/tutorials/speed/high-performance-animations/) then you should be fine

dvingo02:02:12

here is some code using the excellent bardo lib with the older version of om: https://github.com/pleasetrythisathome/bardo/blob/master/examples/om.cljs

baptiste-from-paris05:02:19

I like the ReactCss approach but it does involve more work on each om component. I am not a frontend expert but I guess you could still use CSS3 Animation/Transition for most of the use-cases

pleasetrythisathome08:02:35

@danvingo thanks for the mention! makes me really happy to hear people are using bardo

deas09:02:21

ClojureScript on top. 👌

dhucerbin10:02:42

Hi, is it possible to develop reagent apps without jvm on machine? I'd like to use in teaching environment and I can't install java on these computers. Is lumo sufficient or I need something more to compile apps to js?

pesterhazy11:02:46

How about Klipse?

pesterhazy11:02:12

Works nicely with reagent

thegeez11:02:36

@dhucerbin my own blog, but this supports reagent editing and collaboration in the browser: http://thegeez.net/2017/02/06/crepl_import_4clojure_reagent.html

tomaas16:02:39

hi, I'm trying to use this lib

tomaas16:02:57

but somehow after requiering it [cljsjs.react-select] and trying to used it (js/react-select.Select ....) I get Uncaught ReferenceError: react_select is not defined

rootkat16:02:22

are you aliasing it to js?

rootkat16:02:51

in other words (:require [cljsjs.react-select :as js])

pesterhazy16:02:05

that's not the name of component

pesterhazy16:02:49

here's an example of how to use react-select

pesterhazy16:02:50

@rootcat, (js/...) allows you to reference javascript globals

rootkat16:02:18

cljsjs.react-select is a javascript library?

isak16:02:37

All of cljsjs is, no?

rootkat16:02:05

huh, that would make sense

pesterhazy16:02:17

cljsjs just injects javascript globals

pesterhazy16:02:36

you can't access the libraries shipped through the ns require unfortunately

tomaas16:02:42

thanks pesterhazy

tomaas16:02:10

one more question if I can

tomaas16:02:26

`<Select multi simpleValue value={this.state.value} placeholder='Some text' options={this.state.options} onChange={(e) => this.handleSelectChange(e)} />`

tomaas16:02:14

I cljs I want to pass these multi and simpleValue

tomaas16:02:56

but the map requires key/value pair and in this react component multi does not contain value

tomaas16:02:46

uff sorry 🙂

tomaas16:02:50

I had to see that

tomaas16:02:55

thanks again

pesterhazy16:02:32

pretty sure that's what JSX generates as well

tomaas16:02:29

the options prop in javascript requires an array of of objects [{value: 'X', label: 'Y'}, ..., ]

tomaas16:02:07

can I pass a vector of maps in cljs or do I have to create a vector of js objects?

pesterhazy16:02:24

check my snippet

pesterhazy16:02:05

it has to be js objs, but I think the outer collection can be a vector, but to be safe you can use into-array

tomaas16:02:33

the lib does not fetch and the use the css styles of the lib

tomaas16:02:02

I dont see you using explicitly in your snippet either

pesterhazy16:02:32

I copied them over and just included them manually

pesterhazy16:02:43

the file is in the jar I believe

pesterhazy16:02:07

actually I use this:

pesterhazy16:02:09

[:link {:href "",
              :rel "stylesheet"}]

pesterhazy16:02:14

(that's hiccup on the server)

pesterhazy16:02:36

react-select is awesome by the way, highly recommeneded

mikebelanger17:02:25

hey guys I'm looking for a react widgets for node-diagramming - similar to quartz composer, or let's say facebook's origami tool.

mikebelanger17:02:12

The problem is when I search for 'node' or whatever I get nothing but node-js related stuff.

mikebelanger17:02:16

curses node-js for name

shader20:02:05

when I compile for release with optimizations, I get a "SEVERE: constant location set more than once" when I have code that calls (set! js/location ...). What's a more idiomatic or correct way to do that?

anmonteiro20:02:46

@shader try (set! (. js/window -location) ...)

madstap21:02:05

I'm having some trouble wrapping my head around an api that returns promises. Is there any way to deref a promise and get a value?

madstap21:02:14

Any suggestions on what to read to grok working with promises in cljs?

isak21:02:32

@madstap is it a javascript promise? if so, (.then my-promise on-success on-fail)

madstap21:02:22

The response is printed, but the return value is still a promise

madstap21:02:34

How can I make it not a promise?

isak21:02:41

you could use core.async and put the result on a channel, then use it in a go block in another part of the code

madstap21:02:34

Right, so side effect it somewhere I can get to it. I can reset! it into an atom as well, I just figured there'd be some equivalent to deref. Thanks!

isak21:02:27

https://gist.github.com/swannodette/5882703 here is a short example. Here is js/setTimeout, but you could do it from the promise callback and return a value just as easily

shader22:02:50

does anyone serve bidi routes as edn or similar from the server for use in cljs? My app has grown, and I'm thinking of splitting the api server and spa into different projects, and the main point of intersection is that they both require the route file

shader22:02:43

are there any good reasons I shouldn't split the project in half that way?