This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-07
Channels
- # adventofcode (269)
- # beginners (100)
- # boot (6)
- # cider (4)
- # cljsrn (4)
- # clojure (161)
- # clojure-android (31)
- # clojure-argentina (2)
- # clojure-brasil (8)
- # clojure-greece (45)
- # clojure-india (2)
- # clojure-madison (2)
- # clojure-russia (17)
- # clojure-spec (4)
- # clojure-sweden (1)
- # clojure-uk (32)
- # clojurescript (93)
- # core-logic (2)
- # cursive (21)
- # data-science (2)
- # datomic (46)
- # defnpodcast (1)
- # duct (5)
- # emacs (21)
- # events (1)
- # fulcro (17)
- # graphql (13)
- # job (1)
- # jobs (2)
- # leiningen (11)
- # lumo (3)
- # off-topic (119)
- # om (4)
- # onyx (2)
- # planck (6)
- # portkey (12)
- # re-frame (5)
- # reagent (3)
- # ring (5)
- # shadow-cljs (27)
- # spacemacs (19)
- # specter (6)
- # unrepl (9)
is there a reason why :foreign-libs
stopped supporting URLs at some point?
or is this a regression?
how does https://cljs.github.io/api/cljs.core/locking work ? (notice the macro basically does nothing) is it because cljs is single threaded ?
@qqq yeah it's just for compatibility with Clojure
@thedavidmeister Sounds like a regression. https://clojurescript.org/reference/compiler-options#foreign-libs indicates "URL to the library. This can be either local path or remote url to the dependency file". If you can create a minimal repro: https://clojurescript.org/community/reporting-issues
@mfikes uh, ok, i'll add it to my list of things to do >.<
thanks for helping
for me, i just drop any URL in and it complains about not finding the file on the local file system
it spits out an absolute fs path in the error
java.io.FileNotFoundException: /Users/davidmeister/hoplon-ckeditor5-test/https:/cdn.ckeditor.com/ckeditor5/1.0.0-alpha.2/balloon/ckeditor.js (No such file or directory)
@thedavidmeister Does your URL start off with https:/cdn.ckeditor.com
? Perhaps it needs another slash?
{:foreign-libs [{:file ""
:provides ["ckeditor.lib"]}]})
java.io.FileNotFoundException: /Users/davidmeister/hoplon-ckeditor5-test/https:/cdn.ckeditor.com/ckeditor5/1.0.0-alpha.2/balloon/ckeditor.js (No such file or directory)
clojure.lang.ExceptionInfo: /Users/davidmeister/hoplon-ckeditor5-test/https:/cdn.ckeditor.com/ckeditor5/1.0.0-alpha.2/balloon/ckeditor.js (No such file or directory)
from: :boot-cljs
Maybe it is falling back to this line: https://github.com/clojure/clojurescript/blob/cea2371cb1ec6a5bb46c34772d6d8d9d4689d775/src/main/clojure/cljs/js_deps.cljc#L232
the irony is that i'm getting this error while trying to make a minimum repro for ckeditor
so i need a minimum repro for my minimum repro >.<
Can I check for equality with keywords using (= :keyword/name (first ?data)) ?
Yeah. I do that all the time @sova
Equality in Clojure is pretty good
Usable on deep structures, too
How do I set a nested value of a js object? I see I can use goog.object/getValueByKeys to get a value. But I can’t find a assoc-in. Do I miss something?
look into set!
and aset
: http://squirrel.pl/blog/2013/03/28/two-ways-to-access-properties-in-clojurescript/
@fbielejec will do, thanks!
In plain JS, when you deref a promise, it bundles up "rest of the function" as a callback, and registers it as an event handler right? In CLJS->JS, are there any CLJS constructs that auto become callback handlers? [I'm trying to understand what blocks of cljs code are "atomic" vs "spread across multiple callbacks"]
Can i emit JavaScript code during ClojureScript macro expansion phase? Currently i'm using js/eval to evaluate the generated code. Seems like there could be another way 🙂.
@thheller: I was under the impression that exec "pauses" if the value is not available yet.
@thheller: upon some further reading, I completely misunderstood js promises; thanks for the clarifications
Hi, I have a problem when defining a higher-order function in form-3 reagent component's reagent-render
function. Code follows:
When page is loaded, only "@@@ run me!!!"
and "@@@@annc-dividend"
printed out, the two doall
in annc-dividend
did not run. But when page did hot reload, all 4 prn
printed out. I am confused. Can anyone help me with this? Thanks a lot.
If, however, this render function returns another function - ie. it is a Form-2 outer function returning the inner function - then Reagent knows to replace the Component's render function with the newly returned inner function forever thereafter. So the outer will have been called once but, from that point forward, the inner function will be used for all further rendering. In fact, Reagent will instantly call the inner function after the outer returns it, because Reagent wants a first rendering (hiccup) for the component.
@kardan If the JavaScript object already has the nested structure, I would goog.object/getValueByKeys
to get the desired nested object and then goog.object/set
to set the value on it. (I would avoid aset
as it is for arrays.)
using an atom is not an alternative, because unrelated 'threads' would see values from each other
@dnolen that' works in Clojure, bindings are propagated across gos
We use Var.getThreadBindingFrame to get all the var bindings and store them for when the go
starts. Of course that doesn't work in CLJS where bindings aren't stored in a central location.
@U07TDTQNL ah that must have been fixed later no? I didn’t realize someone got around to that
it's been that way from the start: https://github.com/clojure/core.async/blame/0498ba69fda5d930e3e7568cc90ca933c19c42ca/src/main/clojure/clojure/core/async/impl/ioc_macros.clj#L925
I've heard that go
s don't support bindings for some time though, so I'm not sure where that started.
@U07TDTQNL hrm I’m thought people had examples that didn’t work - but ok!
with-redefs doesn't work (and never will) at least in the way people seem to expect.
So perhaps thats what the examples are using?
won’t work in Clojure either, since you don’t know what thread will run what async block when
I was kinda preparing for this answer, a viable alternative seems to be explicit argument passing
Hi, I want to add date picker, but I don’t found satisfactory project. I want to date range picker on page, and convert date string to timestamp, eg: 2017-12-01 01:01:59
to 1512061319
. Is there a good project recommendation?😀
Maybe this one ? https://github.com/airbnb/react-dates
Available on http://cljsjs.github.io/
If you are using reagent/re-frame, there is re-com: http://re-demo.s3-website-ap-southeast-2.amazonaws.com/#/date
@turkkam @jsa-aerial thanks, I did not find the relevant information about minutes and seconds, I hope enter 2017-12-08 12:12:12
in input text
, and I use re-frame and semantic-ui.
So you want to parse 2017-12-08 12:12:12 as date ? You can just (.parse js/Date "2017-12-08 12:12:12")
iirc require would always pick up one and ignore the other - easy enough to find out though
@deg Yes. The rules are that .cljs
will be loaded in preference to .cljc
when requiring a runtime namespace. (Let me see if that is documented.)
This is not really documentation but it reflects the order tried:
cljs.user=> (require 'x)
No such namespace: x, could not locate x.cljs, x.cljc, or JavaScript source providing "x"
There is a pending ticket for Clojure to do the same: https://dev.clojure.org/jira/browse/CLJ-1797
And, if you are requiring a macros namespace, the order tried is .clj
followed by .cljc
Again, this is not documentation but it is consistent with https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/js.cljs#L83-L87
I'd suggest submitting a PR to https://clojurescript.org documenting this.
I like the rule: If you just learned something that is not documented, well, you know what the right thing is to do 🙂
prob good to doc at https://clojure.org/reference/reader#_reader_conditionals too. I swear I have done this in the past but don’t see it there
Is it feasible to use Clojurescript without React or other Facebook libraries? Or is Clojurescript tightly tied to React/Immutable?
thanks, so there aren't limitations or frustrations with just writing vanilla.js using clojurescript?
I think react is particularly attractive because it works well with idiomatic clojure coding styles, but I’ve definitely used jquery and d3 via interop
I don’t see why any js lib would be significantly harder to use in cljs than js - (though if it’s doing preprocessing for syntax or something that’s not going to blend so nicely for obvious reasons)
Thanks, I don't like Facebook as a company and don't want to get involved in their ecosystem in any way. React has been my main blocker with checking out clojurescript. If I can avoid FB, then I'm interested in trying it. I'll try the tutorial and Moria (mithril wrapper) this weekend.
You can also get a long way without using a framework, just using a mix of javascript interop with google closure.
@mfikes Thanks. I'm running busy the next few days, but will try to submit a PR if no one beats me to it.
@josh FWIW, ClojureScript isn’t even tied to the browser. You can think of it as a language that compiles to JavaScript. It is used for example to create programs that run in Node.js, or drive hybrid mobile apps.
@josh this cljs binding to Vue.js might be interesting - I haven’t tried it though
yeah - I started by seeing what was a viable react alternative and Vue looked like the winner there, and only then looked for bindings / wrappers
because I’d rather work with an imperfect binding to a solid lib (and proceed with interop as needed) rather than an extensive binding to something inferior
but of course starting cljs dev as a new thing, with a lib that is funky to use from cljs… might not be the best introductory experience
It's unusual that there's no CLJS wrapper for Angular 2. Only the blog post with example how to write a simple app.
@turkkam @jsa-aerial thanks, I did not find the relevant information about minutes and seconds, I hope enter 2017-12-08 12:12:12
in input text
, and I use re-frame and semantic-ui.