Fork me on GitHub
#clojurescript
<
2018-08-18
>
bhauman00:08:06

@lilactown why don’t you want to use figwheel.main’s repl?

bhauman00:08:42

its a one liner and requires no setup and it has nicely formatted error messages

lilactown00:08:24

I guess I don’t really know what it does? I just wanted to use rebel-readline with CLJS real quick like to test some code/libraries

bhauman00:08:14

try it clj -Sdeps "{:deps {com.bhauman/figwheel-main {:mvn/version \"0.1.7\"}}}}" -m figwheel.main

bhauman00:08:24

and add rebel readline to the deps

lilactown00:08:39

I just assumed that it was going to pull in a bunch of stuff to build + compile code, which I didn’t want 😉

lilactown00:08:40

that does seem to do what I want in the short term, so thanks! I might hack a bit on rebel-readline to do it as well

qle-guen13:08:37

I will probably try the mailing list

Karol Wójcik13:08:04

@qle-guen I would also try integrating react-youtube using goog.provide

qle-guen13:08:25

hmm interesting

qle-guen13:08:29

I'll look into that

Karol Wójcik14:08:14

Imo you should try to port the library to cljsjs for our great community 😛

qle-guen14:08:32

hmm yeah I could

❤️ 8
🚀 4
jaide15:08:23

Hey again, I finished the cljs script I was working on here yesterday. Would anyone mind a code review and sharing some feedback? https://www.reddit.com/r/Clojure/comments/989b1b/code_review_lumo_based_deploy_script/

mfikes15:08:52

Not sure where you’d like feedback, so here’s some in a thread.

mfikes15:08:09

If you are making a predicate, it is not idiomatic to start the name with is-

mfikes15:08:57

You’re doing some argument processing. clojure.tools.cli works in self-hosted ClojureScript. See http://planck-repl.org/scripts.html

mfikes15:08:27

I’d favor thowing ex-info instead of directly using js/Error.

mfikes15:08:25

#js {:foo 1} is idiomatic while #js {"foo" 1} is not

mfikes15:08:10

You can use strings where you really have to like in #js {"foo bar" 1} or #js {"foo/bar" 1}

mfikes15:08:06

Otherwise LGTM

jaide15:08:37

Thanks! In regards to the clojure.tools.cli what about in a shebang script using lumo? Quick research shows that it’s not the easiest https://github.com/anmonteiro/lumo/issues/291

mfikes15:08:55

There are two concerns with that: 1) Whether the lib has been dowloaded. (Lumo doesn’t download deps, and you’d need to delegate to something else) 2) Whether you are on macOS or Linux (or I suppose Windows). On Linux you need to play games like using exec

mfikes15:08:54

If you know clj is installed you can do clj -Spath to build the classpath for Lumo, and then use clj’s mechanism to specify the dep

mfikes15:08:31

lumo -c `clj -Spath`

jaide16:08:57

Hmm the idea is to package this script with our main js\python repo. I don’t think that kind of dependency is going to be the best option for us. I think some of our other tooling uses yargs or something along those lines which I can wrap easily to parse args.

jaide00:08:10

I made most of the updates you recommended. It’s a bit cleaner now relying on npm’s yargs processing while still keeping compatibility with our dev env. One question that comes to mind though is that I’m creating and dealing with a lot of JS promises. Is there a better async lumo\cljs system I can use or in this case is it preferred to rely on another node library?

richiardiandrea18:08:50

has anybody ever seen the error TypeError TypeError: self__.pred.call is not a function when doing stest/check in ClojureScript

andrea.crotti19:08:51

I'd like to use a library like https://selectize.github.io/selectize.js/ in my clojurescript (re-frame) project

nenadalm19:08:28

You can find wrappers for some existing js libraries on cljsjs (including the selectize): https://cljsjs.github.io/

andrea.crotti20:08:41

Yes I'm using the wrapper already

andrea.crotti20:08:21

But jquery works globally on the dom just not sure how to make it work with reframe

andrea.crotti19:08:14

seems like jquery based libraries are not really fit for the reagent/re-frame model though

kennytilton01:08:10

This is not much help, but I have seen mention of refs in the re-frame context, refs being React’s way of saying DOM. Have you tried #re-frame or #reagent?

andrea.crotti16:08:28

this url suggested should do the trick https://github.com/Day8/re-frame/blob/master/docs/Using-Stateful-JS-Components.md (though I haven't tried yet)

andrea.crotti19:08:20

I'm not sure how to actually use it

andrea.crotti19:08:58

is there a way to wrap them that makes them easier to use?

andrea.crotti19:08:55

I also tried the example in the docs there (js/window.JSON.stringify (js/jQuery (.getElementById js/document "#p1")) for example but js/document doesn't actually contain anything useful, so it never finds anything there

hlolli22:08:49

that's quite a big difference

(time (dotimes [_ 10000] (str (gensym))))
"Elapsed time: 20.742961 msecs"

(time (dotimes [_ 10000] (.-str (gensym))))
"Elapsed time: 8.783585 msecs"
not a question, just "today I learned" comment 😛

thheller22:08:07

try (name (gensym))

hlolli22:08:40

ah I see, it's in lumo these numbers, I'm useing this for generateing id's for promises in IPC browser app, for something I can't compile advance. @thheller name same as str in lumo. Ps, your prototype hack worked with audioworklet, it's all working in pure cljs! Now cleaning up the interface.

hlolli23:08:05

well, if I run these many times, name is faster than str, but bit slower than .-str

hlolli23:08:29

(swap! beers-owed-to-thheller inc)

mfikes23:08:28

I wonder if single-arity str calls are common. We could optimize the macro to emit

(cljs.core.str.cljs$core$IFn$_invoke$arity$1
 (gensym))
(but then perhaps Closure does this for us—I wouldn’t be surprised)

mfikes23:08:36

@thheller yeah, I’m referring to eliminating the array construction and the join call, for the single-arity case

mfikes23:08:29

Oh, right. OK

thheller23:08:22

it would probably be worth it but would risk breaking old code

mfikes23:08:38

Maybe that ticket is about something different? Reading it…

mfikes23:08:53

Specifically, thinking that instead of

(js* "[cljs.core.str.cljs$core$IFn$_invoke$arity$1(~{})].join('')" (gensym))
the macro could just emit
(js* "cljs.core.str.cljs$core$IFn$_invoke$arity$1(~{})" (gensym))
for the single-arity case. But I bet Closure sees that and eliminates the array and join. Only one way to find out 🙂

thheller23:08:10

oh what the heck

thheller23:08:21

I was sure it was doing that already

hlolli23:08:36

the reason I discovered it, was seeing the js object for a symbol

(js/console.log (gensym))
{ ns: null,
  name: 'G__520075',
  str: 'G__520075',
  _hash: null,
  _meta: null,
  'cljs$lang$protocol_mask$partition0$': 2154168321,
  'cljs$lang$protocol_mask$partition1$': 4096 }
So I'd assume (.-name (gensym)) would beat (name (gensym)) by tiny bit.. being an accessor.

mfikes23:08:01

(I’ll try a quick patch to see if it leads to a perf benefit. Suspecting that it may not…)