This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-19
Channels
- # beginners (240)
- # boot (9)
- # braveandtrue (2)
- # bristol-clojurians (2)
- # cider (2)
- # cljsrn (84)
- # clojars (1)
- # clojure (195)
- # clojure-belgium (9)
- # clojure-china (5)
- # clojure-denmark (4)
- # clojure-italy (7)
- # clojure-mke (1)
- # clojure-norway (1)
- # clojure-russia (16)
- # clojure-spec (74)
- # clojure-uk (15)
- # clojurescript (78)
- # clr (3)
- # code-reviews (4)
- # datascript (8)
- # datomic (71)
- # emacs (9)
- # hoplon (18)
- # jobs (3)
- # kekkonen (32)
- # klipse (19)
- # lambdaisland (2)
- # luminus (15)
- # off-topic (6)
- # om (35)
- # om-next (62)
- # onyx (17)
- # overtone (5)
- # pedestal (1)
- # perun (1)
- # planck (31)
- # protorepl (1)
- # re-frame (135)
- # reagent (34)
- # ring-swagger (6)
- # rum (54)
- # specter (3)
- # untangled (14)
- # yada (14)
@borkdude Take a look at goog.functions.debounce
for the use case you described: https://github.com/google/closure-library/blob/master/closure/goog/functions/functions.js#L374-L403
hey all -- quick q if i say (let [[x val]] ...)
and val
is like a compile-time constant would it optimize out the construction of the obj to once (when func defined) rather than many (each time it's called)?
@nikki You can always check the JS output to see what is produced. I suspect that the GClosure Compiler would decide whether or not to make that optimization if a value were a compile-time constant. Advanced Mode compilations are pretty smart and crazy efficient.
@chrisoakman: interesting -- i was wondering if there are more optimizations available when you are equipped with clojure's semantics since you know some stuff is "immutable" or such
@chrisoakman thanks đ
Hi, are there any articles about this
in reagent? I am using d3 in reagent, and want to convert the Javascript d3.select(this)
to ClojureScript. How can I do this? Thanks! I am doing the cljs version of line 84 of this: http://codepen.io/zyzy5730/pen/JKkWQO?editors=0110 .
@cmal I believe this-as
is the preferred way to access JS this
in CLJS: http://cljs.github.io/api/cljs.core/this-as
Ah, Thank you very much @chrisoakman
@cmal this may be helpful, see the links referenced at the end https://github.com/Day8/re-frame/blob/master/docs/Using-Stateful-JS-Components.md
We created a WeChat group for ClojureScript. if you are interested, check out in #clojure-china đ
@mikethompson Hi, I've read those articles and not found they talked about d3.select(this)
. I've tried this
, reagent/current-component
, (reagent/argv this)
and (this-as this ...)
. None of them seems to work. I am still trying to find out how this can be done
@jiyinyiyong xiexie
@cmal In the article, you can see that for example :component-did-mount
is associated with a function with comp
as its argument. I think that might be the this
you are looking for.
@chrisoakman itâs a nice namespace to read through btw, goog.functions
@curlyfry yeah, those assumes that this
is an reagent component or an argument passed to (fn...)
, but in d3 when use .on("mouseover", function(){ d3.select(this)...}
, this
refers to an svg node which triggers an event, maybe a rect or a group or something else.
Has anyone here had a good experience with chromex (developing chrome extensions in clojurescript)? Is it possible to use the REPL/hot code reloading for testing the plugin? That would be a benefit to me over plain JS
Are there any resources for seeing how to localize a cljs app using google closure's i18n tools?
@cmal the this
d3
expects is a DOM/SVG node, those are naturally "hidden" by React
/reagent
oh .. nvm I guess https://github.com/reagent-project/reagent/issues/5
Is there a performance difference between defrecord
and deftype
for function invocations?
I doubt it
though I didn't realize this was the clojurescript room when I answered, so I'm a bit less confident now
@martinklepsch no, defrecord
is basically deftype
with some added sugar
@thheller @gfredericks thanks đ
has anyone done om/reagent with web components, e.g. https://x-tag.github.io/?
I asked this question a few days ago but didnât stick around to see if anyone answered ⌠sorry for the repeat
@borkdude Dirac could be an example of a non-trivial chrome extension built with chromex, figwheel works[1] for me as expected, with one exception: hot reloading does not work for content scripts, but that is a chrome security limitation, not a problem of chromex or figwheel. Also chromex-sample project is already setup to work with figwheel[2]. For me the most important feature of chromex is core.async. Almost all extension apis are asynchronous, so writing plain javascript leads to the callback hell, unless you use promises or similar mechanism in modern javascript. [1] https://github.com/binaryage/dirac/blob/40e21166c741eae9d550a74ea95b2670c76bddf9/project.clj#L473 [2] https://github.com/binaryage/chromex-sample/blob/207cd1a1b5103a614d225c2eb620764a58deec89/project.clj#L30
hey guys i'm currently experimenting with clojure and clojurescript, I've got a really basic server with ring jetty and compojure. Currently every endpoint serves basic html files. I'd rather have a root route "/" that serves html over http (that refers to javascript and css), and every other route actually serves text over http (data stored in edn format). The goal is to have a single page application served on the browser, where buttons and clickables invoke the server as if it were a RESTful API (since it actually is). I'd rather not have to write all the client javascript html and css manually and would much rather write it in clojure. So I'm looking over clojurescript. Can you give me some pointers on how to set up the most basic clojurescript project with lein? I don't need a lot of fancy features or third party library integration right now, I just want to get the minimal possible project up and going so I can recompile my clojurescript into javascript. I'll worry about CSS later, and at some point I will probably want to incorporate figwheel to tighten the development feedback loop. I don't want to take on too much at once though, I know what these tools do but right now I don't know much about the "nuts and bolts" of putting up the scaffolding that a clojurescript development process would require.
The example on the clojurescript website is a little too basic, it doesn't leverage lein and I have to manually invoke java. Thats alright, but I'd prefer to elevate myself just a tad. Not as far as having the whole project layout and choice of libraries done for me, but just a tad higher.
the output of lein new luminus myapp +cljs
will give you a project structure I think youâre looking for
before i delve deep into it, do you know whether it would be a pain to substitute my own choice of libraries?
not a pain ⌠it just helps set stuff up
here are the libraries it will "set upâ (add to project.clj
and create example code) for you, but you can mix or match as you see fit
i just don't want to end up having things happen beneath me that I won't have a chance to understand
although i guess if thats what i want to do i should just go through the official tutorial and work with the java command
@bcbradley maybe have a look at http://boot-clj.com as well
Hi all, any suggestions please, for how to detect a user's (imminent) BACK button navigation, in a cross-device way? e.g. for desktop browsers (no touch screen), tracking y-position to detect the (typical/common) mouse leaving the js/window would work. But not for mobile, etc. Thanks in advance for any help.
@limist back navigation is usually detected via History API
@metametadata I think he wants to "predict" if the user is going to do it.
@limist why do you want to do that though đŽ
I don't think there's a cross browser way of predicting the future đ
@metametadata @martinklepsch Yes, trying to show users some, ahem, advice before they leave us...
@martinklepsch It's a very limited-in-time-and-space prediction, of course. đ
never seen anything like that đ maybe you could show it in the standard dialog box on user leaving the page (using beforeunload event)
@metametadata Thought of that, but it seems there's no customizing of the message for security/privacy reasons, e.g. in Chrome https://www.chromestatus.com/feature/5349061406228480
@limist cool, didn't know about that
@metametadata Yes, me neither until recently; explains why even mighty Facebook can only show you a generic alert when you close the fb tab (and when you have something written but un-posted, somewhere on page).
@borkdude thatâs to be consistent with JS typeof NaN -> ânumberâ
@bcbradley If you donât mind rather new approaches, you could also have a look at #macchiato
Pretty early stage. Very much open for input at this point. Iâm sure we wouldnât mind having an extra set of eyes, or someone asking âhow am I supposed to do X?"
https://gist.github.com/ashnur/3f00f7629d6cff24b4f72f08fc1679cc is this something expected, and if it is, what am i doing wrong?
has anyone else taken a look at this? It looks like a pretty good resource for beginners: https://github.com/magomimmo/modern-cljs