This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-17
Channels
- # admin-announcements (3)
- # beginners (15)
- # boot (5)
- # cider (25)
- # cljs-dev (9)
- # cljsjs (5)
- # clojure (30)
- # clojure-belgium (20)
- # clojure-boston (1)
- # clojure-greece (1)
- # clojure-japan (3)
- # clojure-russia (17)
- # clojure-uk (2)
- # clojurescript (49)
- # clojurewerkz (2)
- # cursive (5)
- # datomic (1)
- # emacs (1)
- # euroclojure (1)
- # hoplon (155)
- # jobs-discuss (17)
- # mount (6)
- # off-topic (1)
- # om (87)
- # proton (2)
- # re-frame (3)
- # remote-jobs (4)
- # spacemacs (2)
- # untangled (12)
Use type
?
cljs.user=> (defrecord A [a b])
cljs.user/A
cljs.user=> (defrecord B [c d])
cljs.user/B
cljs.user=> (= (type (->A 1 2)) (type (->A 2 3)))
true
cljs.user=> (= (type (->A 1 2)) (type (->B 2 3)))
false
The above was via: http://clojurescript.io/ (so that's bootstraped cljs, but I would expect the Java tool chain to produce the same).
@urbanslug: mainly normal Clojure books and then just do it, for example use Reagent
@borkdude: Heh, it seems just doing it is the way with most langs that are on the rise.
how well does clojure handle js interop, for example when you need to interact with a stateful api
something like camera or canvas
is there any pain?
@bojan.matic: In my experience, very little syntactic pain, but sometimes the mutable/immutable way of doing things takes some thinking about.
Does anyone know if there's a way to override the exported name of a CLJS function in JS? I have a CLJS fn with a ->
suffix, and it gets encoded as a _gt
, which isn't very nice.
@bojan.matic: You might find it useful to try and push the mutable bits to the "edge", and use immutable values throughout the main CLJS code.
yeah, i just checked it out myself. i wonder if there could be issues with this
and stuff… if it’s a pure function you’re probably good though
From the cljs quickstart guide, there’s a paragraph saying
Note: Under Node.js there is little reason to use advanced optimizations. While advanced optimizations does apply performance related optimizations, these are now largely obviated by optimizations present in modern JavaScript virtual machines like V8, SpiderMonkey, and JavaScriptCore. For Node.js, :simple or :none optimizations suffice and using them removes the need for extra steps like supplying an externs file.
Does this still hold? If you’re targeting modern browsers then why at all use advanced optimizations?(from https://github.com/clojure/clojurescript/wiki/Quick-Start#running-clojurescript-on-nodejs)
Oh, I think it works. I think I was just returning a (new thing param) to a thing that then called “new” on it again.
How would I do something like this in cljs?
I've tried doing (.dropdown ($ ".blabla") {:key val :key2 {:key3 val2}}) but it's not quite working
Deep in what sense?
do you see that second #js? it has to be there for nested map to be constructed as plain js-obj
you can read more on js interop here, I believe: http://www.spacjer.com/blog/2014/09/12/clojurescript-javascript-interop/
@nnbosko: ah, sorry, now I look again and you don’t have nested objects in your example, sorry my mistake
I got it running
Thanks a bunch