This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-03
Channels
- # beginners (20)
- # boot (407)
- # cider (17)
- # cljs-dev (29)
- # cljsrn (33)
- # clojure (169)
- # clojure-greece (17)
- # clojure-russia (47)
- # clojure-spec (40)
- # clojure-uk (81)
- # clojurescript (64)
- # clr (3)
- # copenhagen-clojurians (3)
- # core-async (1)
- # cursive (28)
- # datomic (26)
- # editors-rus (4)
- # emacs (10)
- # events (1)
- # figwheel (1)
- # funcool (1)
- # hoplon (82)
- # jobs (1)
- # klipse (10)
- # lein-figwheel (26)
- # leiningen (1)
- # off-topic (2)
- # om (153)
- # overtone (2)
- # pedestal (15)
- # proton (1)
- # re-frame (6)
- # ring-swagger (1)
- # rum (1)
- # slack-help (4)
- # untangled (56)
- # vim (24)
- # yada (2)
@ag there is always doto
(doto "hello" (js/console.log "world!"))
; hello world!
;=> "hello"
How can i use a js library that not been packaged into one file? A library can contains multiple modules. With webpack only imported js will be packaged into dist js file. How can I achieve this in cljs?
@vinodg almost never a need to use jQuery when using ClojureScript, but I can understand the temptation; mid/long-term I would try to avoid it
@doglooksgood this can be done with :foreign-libs
Question: I have a webapp, and when i compile my cljs to .js using leiningen for use in an uberjar, it compiles to app-min.js. But now users sometimes have to press CTRL+F5 or CMD+SHIFT+R or similar to prevent viewing the old version. I thought about compiling to app-min-<projectversionnumber>.js, but how do I do that in a project.clj file? Can I get the project version string somehow from the project.clj file? during uberjar building that is
@kah0ona the term you often see for this problem is “cache busting” - it affects css files as well as js files
i found https://www.reddit.com/r/Clojure/comments/4bvtba/how_do_you_cache_invalidate_your_clojurescript_app/ in a brief google search, which may have some pointers
i also found https://github.com/voxdolo/lein-buster but it has five commits and three stars so may not be the tool you end up choosing; might have some ideas/code you can use though
if you google around you should be able to find resources that give you solutions for doing this on arbitrary css/js files as well, unrelated to clojurescript
but I don't think many other folks have exactly the same need set in the clojure space for whatever reason
also: boot has some of the same functionality and it's seen a lot of uptake in the CLJS community
cool, ping me if you need a hand. it's purpose-built for our needs right now, so there may be missing or nonobvious bits in the docs that I've missedd
I’ve got a newbie syntax question here. In this chunk of code
(defn new-counter []
(let [text (atom "")]
(fn []
[:div.row.container
[:div.col-sm-10
[:input.form-control {:type "text" :value @text
:on-change #(reset! text (-> % .-target .-value))}]]
[:button.btn.btn-success {:on-click #(add-counter @text)} "Add"]])))
I believe I understand that the line #(reset! text (-> % .-target .-value))
is changing the value of the atom based on user input, but I don’t totally understand the (-> % .-target .-value)
syntax. Would anyone be able to elaborate on that for me?Ah that helped immensely, so the event target’s value (i.e. what is type into the input element) resets the text of the atom to mirror the user’s input
Awesome, I really appreciate you taking the time to explain that in really great detail
@p-himik I think you can retrieve constructor fn via oget
and then use dot to call new
: (let [c (oget o “my.ctor”)] (c. cp1 cp2 …))
I know you can extend js/jQuery
with protocols, but can you do a similar thing for a jQuery Deferred
object?
when I try
(extend-type (obj/get js/jQuery "Deferred")
...)
I get ERROR: clojure.lang.PersistentList cannot be cast to clojure.lang.Named
.@adamfrey it may be that extend-type
only currently works on symbols - not expressions
I thought this might work
(def deferred (obj/get js/jQuery "Deferred"))
(extend-type deferred
P
(foo
([this] 123)))
(foo (deferred))
but it throws Uncaught Error: No protocol method P.foo defined for type object: [object Object]