Fork me on GitHub
#clojurescript
<
2016-04-25
>
tom04:04:27

I'm using cljsbuild for a min version. For that I'm using optimizations :advanced and there's a part if needs to talk to a global js/YT object from youtube. It renamed "YT.Player" to "YT.oe" or something and this returns as undefined.

shaunlebron04:04:09

@tom ah yeah, that is goog closure’s doing. it requires an externs file to know what not to rename

shaunlebron04:04:16

that page mentions cljsjs further down, it’s a curated list of js libraries that can be pulled in with their externs already provided

tom04:04:59

Looks like that's it

tom04:04:14

but the issue is that the YT iframe API has to be added dynamically from their servers

tom04:04:27

So I cannot include that as an extern to an actual file in my project since it just magically super dynamically appears

juhoteperi06:04:46

@tom: Extern can still be packaged as part of Cljsjs. Google-maps and google-platformjs are packaged this way also: https://github.com/cljsjs/packages/tree/master/google-maps

jumar13:04:11

Any ideas why following doesn’t work for me ?

lein new figwheel om-tut -- --om

jumar13:04:14

Failed to resolve version for fighwheel:lein-template:jar:RELEASE: Could not find metadata fighwheel:lein-template/maven-metadata.xml in local (/Users/jumar/.m2/repository)

jumar13:04:49

Ah, great - I had a typo: “fighwheel"

martinklepsch16:04:56

I'm occasionally looking for a fiddle/playground like thing to test out some closurelib functions or similar. Anyone know of such thing?

dnolen17:04:30

that would be nice, perhaps one of the bootstrapped REPLs already allows that?

martinklepsch17:04:02

would still be nice to have something persistent fiddle-like for sharing

richiardiandrea17:04:04

@martinklepsch: there is cljsfiddle, have you tried that? If you expand on the use case I can see to insert it in http://clojurescript.io

martinklepsch17:04:55

@richiardiandrea: I think cljsfiddle doesn't come with require. Use case basically is being able to toy with closurelib/discuss/share code without needing a full blown env. Doesn't even have to be ClojureScript necessarily.

richiardiandrea17:04:03

I like it! http://clojurescript.io is mature enough for this and really would require a websocket only for sharing what is happening

richiardiandrea17:04:17

which code is evaluated and stuff

richiardiandrea17:04:35

the ast is always available client side and diffs can be sent back and forth

martinklepsch17:04:42

@richiardiandrea: it actually seems to work already(?)

richiardiandrea17:04:35

@martinklepsch: yes, but you cannot share sessions at the moment

martinklepsch17:04:29

wondering if there's a way to integrate w/ all the existing fiddle things like jsfiddle, like you can use coffee-, typescript and others there

richiardiandrea17:04:14

potentially you can, our focus has always been ClojureScript but at the end of the day the all transpile to JS

martinklepsch17:04:14

right. that last line was meant to mean integrate ClojureScript with these services.

richiardiandrea17:04:20

cannot decide for others but it would be very cool indeed

martinklepsch17:04:56

I'll add a vote for ClojureScript integration and ask what can be done by us.

dimiter18:04:38

(defn navigation-menu []
  {:content [{:text "Home"
              :icon "fa-home"
              :href "/"
              :external false
              :navigation-points [:dashboard]}
             {:text "Forms Extra"
              :icon "fa-edit"
              :content [{:text "Potato"
                         :external false
                         :href "/test/ijsdfojisfosidjfosdjif"
                         :navigation-points [:potato]}
                        {:text "Some Other Link"
                         :external false
                         :href "/test/1223"
                         :navigation-points [:potato :other-link]}]}
             {:text "Landing"
              :href "/landing"
              :navigation-points [:landing]}]})
Given the Map function above, I need to write a function to pull out all the nested navigation-points into a single vector. For example, if a node has a :content array, I need to collect all the navigation-points from the :content children.

martinklepsch18:04:42

Looks like a clojure.walk usecase

dimiter18:04:54

For example, “Forms Extra” would return [:potato :other-link]

martinklepsch18:04:45

We need 4 votes to get to the top of the list, we can do this! 😄

anmonteiro18:04:15

@martinklepsch: i think JSBin has CLJS integration

anmonteiro18:04:42

Not sure about save/sharing, but it should work

martinklepsch18:04:49

@anmonteiro: it doesn't have require unfortunately

martinklepsch18:04:17

@richiardiandrea: is there some magic needed to make require work as in http://clojurescript.io?

richiardiandrea18:04:37

but depends on the namespace

richiardiandrea18:04:59

the core should be provided

c0rrzin18:04:36

@dimiter: is this kind of what you want? Implementation seems a little odd…

(defn collect-nav-points [m] 
  (let [nav-points (transient [])]
   (clojure.walk/postwalk
     (fn [form]
       (when (and (vector? form)
                  (= (first form) :navigation-points))
         (doseq [point (second form)] (conj! nav-points point)))
       form) m)
   (distinct (persistent! nav-points))))

dimiter18:04:15

Let me try simple_smile

dimiter18:04:43

Wonderful, exactly what I needed.

dimiter18:04:48

Now I need to figure out why it works simple_smile

borkdude18:04:10

@dimiter: I just found there is clojure.walk/postwalk-demo, you might want to try it out simple_smile

nonrecursive18:04:24

hey yall, anybody have recommendations for a clojurescript error logging service - something like yeller or airbrake?

dimiter19:04:54

Thanks. I think I understand the functionality of postwalk now. Definitely the perfect use-case for it.

mfikes19:04:26

@martinklepsch: For any bootstrap environment to support a require REPL special, it needs to (a) implement it—`require` is not a core function. The implementer can choose to delegate to cljs.js/require, or for higher fidelity and greater support for the various spec options, the implementor can choose to implement require by evaluating an ns form (b) The cljs.js/*load-fn* must be implemented so that requested code can be loaded at require time. Additionally if you want to support import of Closure, you typically need to (c) build an index in the implementation so that you can return the correct JavaScript source for any given Closure “namespace”, and (d) you typically need to obtain the Closure source to actually load—I bet that cat can be skinned in different ways, but one way is to have an auxiliary namespace at build time to cause all of the desired Closure things to be extracted out.

mfikes19:04:44

(Planck, Replete, Replumb, script/test-self-parity, Titrate, they all do the above things… I suspect most of the other non-Replumb-based bootstrapped environments don’t do all of the 4 things above.)

tel20:04:58

Anyone have suggestions on CSS modules for Cljs? I’m assuming there’s got to be some way to make this work nicely with Garden?

martinklepsch21:04:56

@nonrecursive: I know a few people using sentry, works well enough

nonrecursive22:04:46

@martinklepsch: I hadn’t heard of that, thanks!