This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-26
Channels
- # 100-days-of-code (1)
- # aleph (4)
- # beginners (112)
- # boot (2)
- # business (4)
- # calva (3)
- # cider (37)
- # clara (26)
- # cljs-dev (6)
- # cljsrn (1)
- # clojars (4)
- # clojure (89)
- # clojure-brasil (1)
- # clojure-conj (1)
- # clojure-dev (81)
- # clojure-dusseldorf (8)
- # clojure-italy (41)
- # clojure-nl (3)
- # clojure-spec (11)
- # clojure-uk (14)
- # clojurescript (73)
- # cursive (1)
- # data-science (3)
- # datomic (2)
- # dirac (9)
- # duct (6)
- # emacs (4)
- # figwheel-main (1)
- # fulcro (47)
- # incanter (3)
- # jobs-discuss (43)
- # leiningen (18)
- # luminus (6)
- # lumo (4)
- # mount (4)
- # off-topic (31)
- # portkey (8)
- # protorepl (5)
- # re-frame (9)
- # reagent (15)
- # reitit (2)
- # ring-swagger (7)
- # shadow-cljs (28)
- # specter (4)
- # tools-deps (8)
- # uncomplicate (1)
I'm feeling dumb: in this code:
(defn ^:export mark-old-emails-read []
(let [threads (js/GmailApp.search "older_than:10d label:unread \"github\" OR \"firebase\" OR \"3scale\" OR \"jira\" OR \"pagerduty\" OR \"Sentry\" OR filename:invite.ics OR \"Datadog\"")]
(.log js/Logger (str "marking threads " threads))
(doall (map (fn [thread]
(.-markRead thread)) ; <---- this line does nothing.
threads))))
the call to .- does nothingi'm attempting to translate:
;; function MarkOldEmailsRead() {
;; var threads = GmailApp.search('older_than:10d label:unread "github" OR "firebase" OR "3scale" OR "jira" OR "pagerduty" OR "Sentry" OR filename:invite.ics OR "Datadog"');
;; threads.forEach(function(thread){
;; thread.markRead();
;; })
;; }
to clojurescript@lilactown the equivelent of thread.markRead();
(.markRead thread)
I think
This is a good reference https://www.spacjer.com/blog/2014/09/12/clojurescript-javascript-interop/
Is this after you compile/minify?
hmm I recall coming across this issue and making a note let me see if I can find it
I had this issue accessing properties, (.-lngLat click)
would not work since the the properties would get renamed, but (aget click "lngLat")
worked
markRead is not a property though it's a method
If it's a property try aget
as I showed above
Not sure about that one sorry, someone more experienced might chime in
I think you need to define externs for this
To fix this problem, I had to add an extern for the external library method. Google Closure allows for the use of externs. Externs are files that declare the names of external libraries functions that should not be renamed. Google Closure provides extern files for some common libraries—in fact, the project that I was working on already included the jQuery extern, which is why I didn’t see any errors for the jQuery functions.
I also suspect it's not good form to use aget to access properties of objects. So externs are probably better way to go. (use goog.object/get instead)
i'm wishing there was a thing i could put right on that line saying don't mangle this. likely a naieve wish
externs are not terrible to deal with once you get them set up, luckily. good luck!
You can avoid minifying if it's just to demo the code
hey everyone! We have been using PhantomJS for running ClojureScript tests as part of our CI pipeline. We also use reagent on the frontend and upgrading it to the most recent version (from 0.7 to 0.8.1) means we get React 16+ as a dependency. The "problem" is that React 16+ is compiled to a more recent version of JavaScript than the one supported by PhantomJS, so suddenly we're not able to run any tests since our JS imports contain "invalid" JS syntax like Set and Map.
We ran into a similar problem and used core-js
to fill in those syntax holes: https://www.npmjs.com/package/core-js
On my current project, we dropped PhantomJS and are using geckodriver and chromedriver in headless mode.
Hey guys!I am trying to migrate one of my cljsbuild projects to the cli but have some problems getting it working. Is it possible to tell specify source paths it should use for compilation? In cljsbuild:
:source-paths ["src/something" "src/common"]
not relevant to the question, but what is the advantage of cli compared to cljsbuild; the reason you want to migrate?
I have a few different build targets, but some packages are shared between all of them and I use source-paths for that
hmmm or anyone else an idea how to smartly solve this without source-paths?
It's a browser extension. The common page worker is the same in all browsers, the stuff that interacts with the actual page and does it's things
But to communicate with the backend of the browser extension it needs to pass messages and call functions that are different per browser.
Currently I have a common/
package that has all the shared code in it, then for each browser a myextension.browser
package implementation with the specifics for each browser.
The common package then uses myextension.browser
.
During compilation I add the correct myextension.browser
package for each builds. Like chrome would be chrome/browser.cljs
+ common.cljs
, firefox would be firefox/browser.cljs
+ common.cljs
and so on
The worker can just use browser/do-foo
without caring about which browser it's in
I'm not sure I understand the question, but it sounds like you might want code splitting? https://clojurescript.org/guides/code-splitting
What's the intuition behind why
(cljs.js/eval (cljs.js/empty-state) '+ {:eval cljs.js/js-eval} prn)
returns {:value nil}
whereas in Clojure (eval '+)
returns #object[clojure.core$_PLUS_ 0x29f0802c "clojure.core$_PLUS_@29f0802c"]
?@zane I think there’s some extra legwork to get cljs.core et. al. when using self-hosted CLJS
@lilactown This yields {:value 2}
.
(cljs.js/eval (cljs.js/empty-state) '(+ 1 1) {:eval cljs.js/js-eval} prn)
@U050B88UR I see. So you would have expected the cljs.js/eval
snippet I posted to have evaluated to the function +
? Should I file an issue?
I tried the last several versions of and the they all behaved this way.
Interestingly, this works:
cljs.user=> (cljs.js/eval (cljs.js/empty-state) '(identity inc) {:eval cljs.js/js-eval} prn)
{:value #object[cljs$core$inc]}
here’s a quick demo I set up using the new React Hooks proposal: https://github.com/Lokeh/hooks-demo/blob/master/src/hooks_demo.cljs
hi, beginner to javascript and cljs
how do you specify that you want all your dependencies (cljs itself, closure, ...) compiled together into one big js file? I have a simple namespace that just prints and looking at the emitted js file after lein cljsbuild once
. it just reaches into other folders in the target directory to load namespaces
@williewillus I recommend going through this at least once if you're just starting out https://clojurescript.org/guides/quick-start
ah, the structure of my :cljsbuild section was wrong (didn't have a nested :compiler submap) thanks!
Is there a simple way to postwalk over a form's collections? Normal clojure.walk/postwalk
returns [k v] for map entries and I do not think I can tell with certainty if it's a vector or map entry. Thoughts?
There were changes to Clojure/Java in this area in the last year or so. Have you looked at the ClojureScript implementation to see if it tracked those changes? If not, you can of course copy and paste either Clojure/Java's or ClojureScript's postwalk implementation into your own code and tweak it to your wishes.
Recent changes in Clojure/Java, IIRC: https://github.com/clojure/clojure/blob/28efe345d5e995dc152a0286fb0be81443a0d9ac/src/clj/clojure/walk.clj#L45-L46
It appears that ClojureScript's implementation hasn't been changed to match: https://github.com/clojure/clojurescript/blob/9a8196ebfe4265feda88a06de84affb9df469012/src/main/cljs/clojure/walk.cljs#L47
(if indeed it is possible to call a MapEntry constructor in ClojureScript instead of vec
on the line I linked to -- not enough ClojureScript-fu in me to tell yet)
Thanks for taking the time to look into it! I'll have to try this weekend and see if I can get it working.
Oh, wait, perhaps there is another change we need to port... looking for the change...
The change hasn't yet landed on master: https://dev.clojure.org/jira/browse/CLJS-2909
Hey everyone. I’m new here. I’m trying to figure out what level of support there is for the on going development of some clojurescript libraries. I’m worried that some projects in the community go stale. Specifically, I’m looking into om next, but it looks like it hasn’t been worked on in a little while.
If you're not already invested in the tooling but like the ideas, Fulcro has a lot of active development and started based on Om Next (http://fulcro.fulcrologic.com/)