Fork me on GitHub
#clojurescript
<
2016-05-08
>
spiralganglion00:05:39

While I have the mic... :repl-options {:init-ns foo.bar} seems to be ignored by Figwheel, and I haven't yet found an alternative. Any suggestions?

risto00:05:02

Yeah, I see what you're saying. Maybe add-watch would work better? I know that Figwheel should report the error lines where they appear. Or you could try Vivaldi, it's pretty nice

risto00:05:27

I would def like to know if someone has managed to get the console traces/line numbers work with source maps

spiralganglion00:05:49

Well, it seems to work in Chrome.

spiralganglion00:05:57

But if you mean "in other browsers besides Chrome" then yes, I too would love to know if someone has managed to get this to work, haha.

sbmitchell04:05:10

has anyone here tried to do a port of react-router? or accomplished something similar?

adamkowalski04:05:37

https://github.com/ghedamat/reagent-react-router procede with caution, it hasn’t been updated in a year

sbmitchell04:05:52

yea I saw that but he just wrapped react-router

sbmitchell04:05:04

I was looking for a native version to fork perhaps 😕

sbmitchell04:05:38

I may just use secretary and accountant and add a component wrapper around them

sbmitchell04:05:43

might be easiest way to go

adamkowalski04:05:47

you might wanna look into the non react specific solutions: https://github.com/juxt/bidi

adamkowalski04:05:05

they have a comparison chart where they show the different available routing solutions

sbmitchell04:05:13

yea I just need client only

adamkowalski04:05:43

i think that it might be worth making your own and just wrapping the html 5 history api

sbmitchell04:05:58

I have a ref impl its just not great lol

sbmitchell04:05:13

I basically just stole helpers from secretary and accountant

sbmitchell04:05:21

and then wrapped them in reagent components

adamkowalski04:05:45

hmm, I have been working on something. maybe I will try to make it more generalized and release it as a standalone package

sbmitchell04:05:46

but I might just use the libs directly instead

adamkowalski04:05:20

i honestly really like react router and wish we had something similar to that on cljs, and none of our existing solutions use its approach

adamkowalski04:05:41

which is I am starting from scratch as opposed to using something else

sbmitchell04:05:19

I like the declarative nature of react-router and its just a container component

sbmitchell04:05:29

instead of using async dispatching to trigger a state change

sbmitchell04:05:38

just for routing specfically

sbmitchell04:05:12

like most re-frame projs

sbmitchell04:05:27

I dislike the routing pattern used in the templates

adamkowalski04:05:28

for me another thing is on transition hooks. I would really like to be able to create a transition as a new page comes in. similar to how ios/android does

adamkowalski04:05:46

so if I have a master > detail view, I can have the detail slide in from the right

adamkowalski04:05:58

and if I want a new item I can have it slide up from the bottom or something

sbmitchell04:05:15

like a dialog transition with a hash route or something

adamkowalski04:05:48

yeah, still haven’t figured out how to make it work well. especially if you want it to remain declarative

sbmitchell04:05:04

well you need to pass in props and query strings

sbmitchell04:05:43

so youd just have to have ?dialog=true then inside the parent component it would need to trigger the state change on component-will-receive-props

sbmitchell04:05:00

for the dialog component which would need to be controlled externally

sbmitchell04:05:22

interesting...I think ill add that to my ref impl

adamkowalski04:05:47

nice! if you finish it you should toss up a link on here, im sure people would be interested to see how it worked for you

sbmitchell04:05:16

will do of course..just started working on it past 2 hrs or so 😛

madvas09:05:42

When compiling to node.js I want to set js/document as (set! js/document (js/require "libxml-dom/lib/document.js")), but closure compiler doesn’t allow me, cuz document is defined as constant in externs file. I’ve tried :closure-warnings {:externs-validation :off}}, but didn’t help. This is error:

ERROR: JSC_CONSTANT_REASSIGNED_VALUE_ERROR. constant document assigned a value more than once.
Original definition at externs.zip//browser/window.js:47 
Is there workaround for this?

risto09:05:32

@ivanreese: Vivaldi uses Chrome Dev Tools and Chrome Extensions. It works there.

jrychter09:05:02

Continuing to modularize my app. My :modules section has reached 125 lines. 😱

lsnape09:05:38

I’m having some trouble debugging a Clojurescript RTE that occurs when loading the bluebird.js code at the top of my target js file, before it hits any of my app code. It and only happens when I set :optimizations :advanced, and interestingly if I set the compiler option :pseudo-names true the code works fine. Does anyone know what that might mean or what else I could try to hone in on the error?

lsnape09:05:30

bluebird.js is being pulled in by the funcool/promesa library

juhoteperi10:05:24

@lsnape: Try :output-wrapper. It could be that minified names in adv optimized code and the library clash.

lsnape10:05:20

@juhoteperi: thanks. That’s likely to be the cause, trying now..

lsnape10:05:38

also found a related discussion in this channel’s history: http://clojurians-log.mantike.pro/clojurescript/2015-10-12.html

jrychter10:05:05

clj->js should be named cljs->js. This gets me every time.

lsnape10:05:37

@juhoteperi: that was it. Thanks for your help :thumbsup:

lsnape10:05:43

Surprised that these naming collisions aren’t more common. Perhaps they are and I just haven’t come across it before

juhoteperi10:05:16

I think library code is often wrapped in a closure which prevents clashes.

jrychter10:05:49

Alas, I have to give up on ClojureScript modules. I can't get them to work at all. Even a simple split (one unused namespace in one module and everything else in the default :cljs-base module) produces cljs-base that loads with errors (undefined symbols). Perhaps some day…

abdullahibra10:05:05

i have defined some global atom at clj file which i need to use inside cljs file, how can i achieve this?, i have read about reader conditionals which expect files cljc, but still don't know how can i do this inside cljs

jrychter10:05:39

@abdullahibra: make a single cljc file instead of clj+cljs. Then use #?(:cljs (cljs-form-here) :clj (clj-form-here)).

abdullahibra10:05:25

@jrychter: and what next should i do with this cljc?

abdullahibra10:05:57

suppose i want to view the content of the atom from clj into html tag at cljs

jrychter10:05:15

@abdullahibra: ah, that depends on what you use for compilation. In my case (leiningen+cljsbuild), I add src/cljc to my :source-paths, place the cljc there, and everything else happens automatically.

jrychter10:05:30

@abdullahibra: actually, you add the path twice: to :source-paths of the main project structure and to :source-paths in :cljsbuild :builds :your-build-name map.

abdullahibra10:05:32

@jrychter: thanks, i'll try it

abdullahibra12:05:57

i'm trying to get value from redis using carmine and attach it to cljs, but i got undefined, (def foo #?(:clj (wcar* (car/get "foo")))) (defn foo [] (js/console.log foo)) (foo) i have required carmine using #?(:clj (:require [....])) in ns

abdullahibra12:05:07

is there something i miss for this?

abdullahibra12:05:49

previous code i placed at cljc file

abdullahibra12:05:23

there is a point i can't understand about interaction between clojure and clojurescript in project, can anyone help me to get it?

abdullahibra12:05:02

i got it, i can interact with the clj "server" using Ajax, or maybe i'll try :crossovers, or directly eval clojure code

bhauman17:05:03

@abdullahibra: no :crossovers are no longer needed see Reader Conditionals http://clojure.org/guides/reader_conditionals

bhauman17:05:52

oh sorry I see that you already have that info

turbopape17:05:25

Hi guys, It’s been a while I did’nt look in Clojurescript,

turbopape17:05:48

but is it able to eval and load macros without :refermacros nowadays?

genRaiy18:05:09

these also came through on the Cognicast Episode 100 … on the other hand I want to be sure to pick features that are accessible (for some value of that term!)

genRaiy18:05:37

to new to Clojure/Script programmers ...

genRaiy18:05:44

I have seen core.async referenced on quora but am not so sure that’s yet considered a sufficiently core / default feature (but am open to persuasion!)

genRaiy18:05:23

these are also things that the JS community is pushing but that are far from defaults on the platform (except LISP of course!)

genRaiy18:05:41

I mean they are not pushing LISP 😉

genRaiy18:05:39

All essentially modelled around simplicity: LISP for its consistently simple syntax, Immutability for consistent data handling and laziness for the ability to have powerful yet high performance abstractions

mvaline19:05:55

Hey guys, I'm using re-com (https://github.com/Day8/re-com) which has a couple of css files and images that need to be included as dependencies. Is there a relatively easy way I could load them from index.html without copying them into my resources/public folder to avoid committing dependency files to VCS. Essentially accessing, re-coms resources/public folder in my dependency tree somewhere.

sbmitchell20:05:24

Seems like if they are already compiled and are assets you would want them in version control

sbmitchell20:05:54

I assuming the problem you are trying to solve is...if I update re-com how can I ensure I have the correct assets

mvaline20:05:26

that is the main issue yes, I do see your point about committing however generally third party css I would handle using a package manager.

sbmitchell20:05:08

well there isnt a package manager that pulls it from the jar if it exists in there

mvaline20:05:10

its not a big deal to commit the files for sure, more about understanding the dependency system better seeing what can be done

sbmitchell20:05:12

you could write a script to do it

sbmitchell20:05:27

Ive never tried personally

mvaline20:05:44

yeah that seems like the simplest route currently

sbmitchell20:05:10

I guess I do see a good use case related back to how node_modules work

sbmitchell20:05:24

I mean I have my own component lib with its own assets

sbmitchell20:05:36

and it is a pain to always bring in the new css manually

sbmitchell20:05:51

I mean a 10 minute pain..but a pain nonetheless

mvaline20:05:45

yeah its relatively minor, and easy to document in this case since its only a few files. I could see it getting confusing across a team on a larger codebase with many different css dependencies

mvaline20:05:20

thanks though for chiming in, I'll keep digging around any maybe script it as part of the build process

sbmitchell20:05:45

cool yea now that you brought it up I may in fact look into that myself 😛

mvaline20:05:09

sweet, let me know if you come up with anything cool

genRaiy21:05:13

In general .@raymcdermott that's a no

genRaiy21:05:43

Fair enough

abdullahibra22:05:45

if i have multiple of this <a href="#" id="foo"> <img src="..." id="bar"></img></a> and i h

abdullahibra22:05:45

have create an listen even when click the link image and i want to get the src attr of the image clicked, all links and images have same id

abdullahibra22:05:28

i tried (-> (js/$ this) (.find "img") (.att "src")) i got undefined

abdullahibra22:05:36

can anybody help in this?

spiralganglion22:05:42

@raymcdermott: I was going to comment earlier but I got sidetracked. Here's my anecdotal 2¢ — what drew me to CLJS from JS was, largely, the talks given by the various members of the CLJ community. There were so many interesting ideas to chew on... I guess it sort of nerd-sniped me into learning the language. So if I had to pick the #1 quality of CLJS that attracted me, it would be the quality of thought and emphasis on design and consideration, both in the language itself and in the way people use it to build software. Beyond that.... I jump back and forth between CLJS and JS a lot these days, and when I'm in JS the main thing I miss is the uniformity of the CLJS data structures and the functions that act on them. It kills me a little bit every time I need to merge two object hashes in JS, or want to use something resembling a set.

spiralganglion22:05:17

If I had to pick my 3 tentpoles, they'd be: 1) It's a thoroughly well-designed language — none of this "10 days", none of this "let's add promises, and generators, and async/await" or "let's add yet another kind of function with its own syntax" 2) The data structures — sure they're persistent, and that's a cool thing to learn about if it's a new concept to you.. but they are also consistent, and many of the functions you'd use on any one will work on all the others (thanks, seq abstraction!) 3) For me, the LISP syntax.