Fork me on GitHub
#clojurescript
<
2017-12-04
>
romain00:12:40

Is there an equivalent of cljs-devtools for Firefox? (and more general, how does Firefox compare to Chrome for tooling?)

levitanong03:12:09

given some symbol, how do resolve it as a var and get its value?

mfikes03:12:04

@levitanong There is a newly-introduced resolve macro that may do what you need. For example @(resolve 'foo.core/a)

mfikes03:12:44

I suspect it may be constrained to compile-time constructs.

mfikes03:12:22

(In other words, the symbol needs to be available at compile time.)

levitanong03:12:49

i see, thanks!

levitanong03:12:50

@mfikes oh, here’s a snag. I’m working in cljs.analyzer, and resolve is in cljs.analyzer.api

mfikes03:12:52

OTOH, in self-hosted ClojureScript, you can do things at runtime:

(def sym 'foo.core/a)
@(planck.core/resolve sym)

levitanong03:12:23

oh oops, i was looking at the wrong docs

mfikes03:12:23

@levitanong Well, there is cljs.core/resolve

levitanong03:12:14

@mfikes here’s a snag. the argument to cljs.core/resolve must be a quoted symbol.

levitanong03:12:08

given

(defrecord Foo [bar])

(def a 'Foo)

(resolve a)
;; Assert failed: Argument to resolve must be a quoted symbol

mfikes04:12:44

Right, in JVM ClojureScript, resolve is essentially a compile-time construct.

qqq07:12:29

Are you making a cross domain request?

qqq07:12:38

You may have to setup something on the erver

rainmote07:12:33

yes, I’m see http response status and data is ok, but error log in browser console.

thheller09:12:11

at least Access-Control-Allow-Origin and Access-Control-Allow-Headers for each additional header are required.

thheller09:12:27

(on the server)

rainmote02:12:54

Yeah, it’s work. Thank u very much.

sergiodnila20:12:13

hi, i remember a project that allowed to use clojurescript in a html file in a script tag with a type=“text/clojurescript” so you would be using cljs directly, all you needed to make it work was include a js file before, but i don’t remember the name of the project, google it but no luck, couldn’t find it again. do anyone remember this project and can point me in the right direction?

sergiodnila16:12:37

no, that wasn’t this one is allows to use cljs inside a script tag as if it were javascript

shaun-mahood19:12:32

Sorry, no idea then. It sounds interesting though!

sova-soars-the-sora22:12:52

Hi everyone, I am trying to figure out the best practice for handling logins in 2017. Any helpful pointers or strong / passionate opinions ?

Ryan Radomski22:12:51

I've been reading blog posts about Reagent vs Om and from what I've read, people generally tend to say it doesn't matter too (I use very loosely) much which you opt for. Are their use cases for one or the other or are they really that similar? Are there some sort of common exemplars that they both leverage that makes them so interchangeable in people's eyes or are their clear cut strengths of one or the other?

sova-soars-the-sora22:12:40

@radomski the three players in the clojurescript world right now with realtime websites are Reagent, Rum, and Om.next ... maybe a few others depending on what tools you want to use. Those three are all nice wrappers ovver React elements and the underlying web comms / events will be the same in every one of them. om.next is very opinionated about data organization and components follow an idiomatic layout. it's more like learning how to imitate om.next style to get the components you want out of it. rum and reagent are very similar, rum is made by the same person who maintains datascript, which is like a clientside database -- this is especially nice because when the serverside database changes you can just push transaction deltas to the users and update their clientside database, instead of sending huge chunks of data just send database deltas ...

Ryan Radomski23:12:18

I have been faithfully using om.next since I started doing clojurescript frontends a little while ago and I absolutely love the reconciler. That seems to be the biggest difference to me, but I'm a noob to all 3 major options. Other than easier datascript usage, are there other important differences? I too would also accept passionate opinions.

sova-soars-the-sora23:12:53

The Reconciler is great. In Rum you mark certain atoms as Watched/Observed for changes and that will update components that reference that atom val.. aside from those points, the one big thing is HTML/hiccup interplay, in rum one defines the components using hiccup html syntax [:div#main_cointain [:p "hey sup" ] [:p "articles yo"] (rum-component-doug) ] and so you can invoke rum components as functions that spit out hiccup-html .

sova-soars-the-sora23:12:25

another topic is serverside rendering, which is fairly essential for SEO and having the appearance of persistent pages, and SSR has been solved in Rum, Om.next (in the Fulcro [was "untangled"] library) and presumably reagent. I could never quite get SSR to work in Om.next but maybe strides have been made since then

dnolen23:12:52

@radomski I think you can be very productive with any of those options. I can’t really offer an impartial opinion. But I will say that you can cross-pollinate ideas into whatever library you chose. I’ve built om.next inspired reagent apps for example.

Ryan Radomski23:12:53

@dnolen That's the precise reason I asked! I had a strong suspicion going in that the ideas from one library weren't mutually exclusive to the next. @sova That's a lot more helpful than the posts I read. I needed something more concrete to start searching for benefits of one over the other. It looks like all of them do a really good job on the simplicity aspect so I'm confident any choice wouldn't paint me into a corner.

nooga23:12:15

any ideas?

sova-soars-the-sora23:12:39

what does (first ) return?

sova-soars-the-sora23:12:03

some emoji are a double unicode smash iirc

phronmophobic23:12:05

what does (pr-str (second "💩")) print?

pmn23:12:46

noob question; searching is failing me. I'm getting back into clojure after some time away, and playing with ClojureScript & figwheel. I'd like to be able to do lein figwheel and have that start my compojure backend as well as figwheel... Is that possible, or will I have to do lein ring server and lein figwheel separately? I'm using :ring-handler in my project clj and see that it's starting ring successfully but doesn't appear to do anything when I visit http://localhost:3449. a gist of my project.clj is here if it's useful: https://gist.github.com/pmn/ffa2753b239c915f590e6f38e1b2c77f (my project is laid out as src/clj, src/cljs, and src/cljc if the namespaces look weird)

pmn23:12:06

the last time I messed around with clojure on the web was with noir... so things have changed a bit since the last time I built a website 🙂

dnolen23:12:55

@nooga I don’t see that

dnolen23:12:35

I see an unprintable character

dnolen23:12:02

(.-length "💩") ;; 2 is why though

dnolen23:12:36

same “issue” on Clojure JVM