Fork me on GitHub
#clojurescript
<
2016-04-02
>
nberger00:04:26

ok @darwin, thanks anyways

jvtrigueros01:04:24

@bhauman: That fix was so simple! Yes, thank you. I was able to call the function and then it all worked. You're awesome! 👍

jiangts02:04:28

I'm trying to use a js react component in my clojurescript project but can't figure out how to include the commonjs module into my build... trying this http://blog.fikesfarm.com/posts/2015-12-22-foreign-libs-processing-in-repl.html didn't seem to work

jvtrigueros02:04:37

@jiangts: I dealt with this earlier, what exactly are you trying to do, do you have some code I can help you look at?

jiangts02:04:33

yes! I'm trying to integrate https://github.com/balloob/react-sidebar into my project

jiangts02:04:21

and I npm install'd react-sidebar

jiangts02:04:34

and in my project.clj I've added

jiangts02:04:35

:foreign-libs [{:file "node_modules/react-sidebar/dist-modules/sidebar.js" :provides ["sidebar"] :module-type :commonjs} {:file "node_modules/react-sidebar/dist-modules/index.js" :provides ["index"] :module-type :commonjs}]

jvtrigueros02:04:09

And what's the error you're getting?

jiangts02:04:30

when I require index :as react-sidebar

jiangts02:04:38

react-sidebar/default is nil

jiangts02:04:32

the compile doesn't give any errors but I only get nil when I try to use require'd code!

jvtrigueros02:04:24

Let me try, I noticed that react-sidebar needs react and react-dom as peer dependencies

munro03:04:53

hey, trying to run figwheel + regeant in cursive, following the guide. problem I'm having is when I run (cljs-repl) all that happens is it runs nil

munro03:04:31

lein figwheel dev works, but the repl is so bad XD

munro03:04:54

ok, I figured it out. the template I was using had my cljsbuild in a :profiles :dev, and I pulled it. not sure how profiles work, but I think I would have to use a library to extract the :dev profile and manually pass it into start-figwheel! if I wanted to use it that way

urbanslug04:04:26

How can I use format in cljs?

urbanslug04:04:00

Also I can’t require clojure.core in cljs?

mfikes05:04:56

@urbanslug: You can’t. Since there is no format I had to write a pad-left for bootstrap before it was in fashion to do so simple_smile https://github.com/clojure/clojurescript/blob/16666f37cc13ead5a66330046db82a2976b6f1f0/src/main/clojure/cljs/compiler.cljc#L135-L138

urbanslug05:04:13

@mfikes: Thanks explaining with an example.

mfikes05:04:59

@urbanslug: Perhaps, depending on what you want to do, you can make use of cljs.pprint. It has some fairly sophisticated formatting capabilities.

mfikes05:04:47

@urbanslug: In particular, check out cljs.pprint/cl-format.

urbanslug05:04:30

What I want can be achieved using str

rauh05:04:17

@urbanslug: there is also goog.string.format

moxaj17:04:12

Hey people! I have a library (`foo`) in the making, has a CLJSJS dependency (`bytebuffer`). I have another app (`bar`), which requires foo. When compiling bar with advanced optimizations, the sources of bytebuffer do not get munged / dead code eliminated. How could I include those?

dnolen18:04:45

@moxaj: DCE doesn’t apply to 3rd party JS libraries, only Closure compatible JavaScript

lwhorton19:04:07

i’ve got a really simple question I’m hoping someone can answer … what’s the “right way” to defer to someone else’s api through my own?

…
[other-api.core :as other]
…

(defn some-func [& args] (apply other/some-func args))
that’s the simplest thing I can think of, but I want to make sure i’m not shooting myself in the foot...

dm319:04:12

(def some-func other/some-func) ?

lwhorton20:04:41

ah cool, thanks @dm3

dnolen23:04:41

@dm3 @lwhorton you have to be careful with that pattern - don’t do that in libraries for example - will prevent DCE & code motion.

dnolen23:04:08

(DCE - Dead Code Elimination)

lwhorton23:04:14

hm, so whats’ the preferred way to do it? the idea is i’m wrapping a library with my own decorated api, but there are a few pieces of that api that don’t need any enhancements/decorations.. so I just want to defer to the original implementation. I’ve dug around wikis at /clojure/clojurescript but unfortunately it’s pointing me to a whole book that’s 16 chapters 😕

dnolen23:04:56

@lwhorton: your suggestion works

darwin23:04:02

@dnolen: interesting, I didn’t know it prevents DCE, I’m sure defonce prevents DCE, because the definition is wrapped in a global test Closure cannot reason about, but plain defs should be fine as long as Closure has full visibility of both places I believe

dnolen23:04:37

@darwin all I know is I toyed around with aliasing when I was working on code motion and I saw bad results for DCE

darwin23:04:39

ok, I’m also not sure, also this behaviour could have changed between Closure versions as they implement more clever optimizations