Fork me on GitHub
#clojurescript
<
2016-01-20
>
nayzak00:01:27

hi everyone simple_smile

nayzak00:01:27

I'm very new to cljs and now studying modern clojurescript tutorial at github. My goal is to create website with golang backend and cljs frontend simple_smile At now I'm stuck with boot-reload task. Problem is that cljs task has compiler option :asset-path "/js/main.out" and it's working fine: js paths is http://host:port/js/main.out/some.js. But when boot-reload tries to reload my web page, it trying to load js files from http://host:port/main.out/... I did some googling and nothing helped me. Boot reload task also has option :asset-path but it working in different way as I understood. Any suggestions? Accept of using lein simple_smile

nberger00:01:12

Hi @nayzak, welcome! You could check out the saapas sample project: https://github.com/Deraen/saapas/blob/master/build.boot. There you'll see in the build.boot that it uses :ids #{"js/main"} for both cljs and reload tasks.

nberger00:01:21

Then it has a js/main.cljs.edn file in https://github.com/Deraen/saapas/blob/master/src/cljs/js/main.cljs.edn where it specifies the init-fns which will be called on reload. Also, there's a #C053K90BR channel where you'll get quick answers to all your boot related questions. Both boot and lein are great options, keep on with boot simple_smile

nayzak00:01:33

Thanks @nberger, I will check it out.

nayzak00:01:31

Wow, it worked for me. Big thanks again, @nberger!

andrewboltachev07:01:34

If I have to write JS, what library can I use to have all the familiar CLJS data processing functions, or sth like? Will Mori work, or are there any others? simple_smile

andrewboltachev07:01:29

Or, if I have JSON (already parsed, 4-5 levels nestedness), can I turn it into immutable/easier-to-handle DS easily?

lucasbradstreet09:01:33

Does anyone know the correct way to type hint numbers in clojurescript now? This breaks under 1.8 https://github.com/lbradstreet/instaparse-cljs/blob/master/src/cljs/instaparse/auto_flatten_seq.cljs#L37

lucasbradstreet09:01:54

I was following what clojurescript core did, but now it uses a bunch of macros everywhere to do the same thing, and I’d rather not resort to that.

lucasbradstreet10:01:06

Hmm. Good point. I’ll give that a try. Thanks!

bojanx10012:01:16

Hi. Silly question: Is there a way to use multimethods in different namespaces without actually requiring them somewhere (just the defmulti)- like dynamic load or something? Thank you.

Petrus Theron13:01:43

Any known issues with js interop on advanced cljs builds? Calling the momentJS from an unminified build works, but fails in a minified production build:

(defn moment [arg] (.moment js/window arg))

(defn smile-box [data]
  [:div
    [:div.text-center.text-muted (-> (moment (:timestamp data)) (.fromNow))]
    [:br]])
I suspect that .moment is being mangled somewhere for minification.

Petrus Theron13:01:25

aside, using reagent.

martinklepsch13:01:27

@petrus: are you using cljsjs/moment?

martinklepsch13:01:31

For advanced compilation you need externs. There's more on the whys and hows here: https://github.com/cljsjs/packages/wiki

bostonaholic14:01:42

@petrus: are you including moment in your externs?

martinklepsch15:01:57

How you load google maps JS api in your ClojureScript apps? just add a script tag? or is there something more closurelib-y that could be done? I'll give goog.net.jsloader/load a try but curious about other approaches

martinklepsch15:01:21

(defn load-gmaps! []
  (doto (loader/load (str gmaps-uri gmaps-api-key))
    (.addCallbacks
     (fn [] (js/console.info "GMaps API loaded"))
     (fn [] (js/console.info "GMaps API failed to load")))))
Guess that'll do.

martinklepsch15:01:13

Unfortunately the API always returns success even if the api key is invalid

borkdude15:01:12

Is there a prismatic/schema counterpart in JavaScript?

jaen15:01:47

http://json-schema.org/ is probably the closest equivalent

curtosis18:01:31

on the interop front, has anyone tried/been successful at packaging/calling the AWS SDK? It's not in CLJSJS, but assuming that's because proprietary, I figure someone must have some experience with it.

dnolen18:01:02

@curtosis you mean from the browser?

curtosis18:01:17

yup. node/require apparently works fine from node.

curtosis18:01:40

(though I have no personal experience verifying that)

dnolen18:01:51

if you’re doing this from the browser then you will need to supply externs

curtosis18:01:11

that's what I was thinking.... I'm not terribly confident in cljs yet, so I was hoping someone had already gone down that path. simple_smile but then again, getting my hands dirty would be good experience.

martinklepsch18:01:58

@curtosis: There's a #C0E66E1H7 channel where you can ask questions if you're stuck simple_smile

curtosis18:01:08

this place has everything!