This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-29
Channels
- # aleph (3)
- # announcements (16)
- # beginners (85)
- # calva (2)
- # cider (13)
- # clj-kondo (84)
- # cljdoc (3)
- # clojure (109)
- # clojure-belgium (1)
- # clojure-china (39)
- # clojure-europe (4)
- # clojure-france (1)
- # clojure-italy (70)
- # clojure-nl (8)
- # clojure-spec (8)
- # clojure-uk (53)
- # clojuredesign-podcast (14)
- # clojurescript (43)
- # cursive (25)
- # data-science (1)
- # datomic (4)
- # emacs (10)
- # figwheel (4)
- # garden (4)
- # graphql (5)
- # jackdaw (10)
- # jobs (5)
- # jobs-discuss (5)
- # lambdaisland (2)
- # leiningen (3)
- # luminus (7)
- # off-topic (32)
- # pathom (11)
- # pedestal (2)
- # planck (15)
- # re-frame (12)
- # reagent (4)
- # remote-jobs (2)
- # shadow-cljs (51)
- # sql (29)
- # tools-deps (47)
Hello guys
is clojurescript depending on any browser?
i mean is the js code emitted from clojurescript could be run correctly on specific set of browsers, like chrome and firefox, but not IE or any else?
is google closure compiler target specific set of browsers ?
@abdullahibra cljs compiler emits ES3 compatible code
^ Is that the case even when we use newer stuff like promises via interop? Does Closure include the relevant polyfills and emit ES3 compatible code in all cases?
but for that you have to add compiler option :rewrite-polyfills true
good thanks
Is there a way to access build id at compile time, or would I use a closure define?
Do you know some of the test reporters which work seamlessly in node.js environment with cljs.test?
I use doo (https://github.com/bensu/doo) with humane-test-output (https://github.com/pjstadig/humane-test-output).
Here is my part of my :test
profile in leiningen:
:test
{:dependencies [[pjstadig/humane-test-output "0.8.3"]]
:plugins [[org.clojars.nenadalm/lein-doo "0.1.11-SNAPSHOT"]
[lein-cljsbuild "1.1.7"]]
:cljsbuild
{:builds
{:test
{:source-paths ["src" "test"]
:compiler {:main app.run-all
:output-to "target/test/app.js"
:output-dir "target/test"
:target :nodejs
:npm-deps {}
:optimizations :none
:pretty-print true
:source-map true
:source-map-timestamp true}}}}
:doo {:build "test"
:paths {:karma "./node_modules/.bin/karma"}}}}
some npm dependencies:
;; devDependencies
[karma "2.0.0"]
[karma-cljs-test "0.1.0"]
[karma-firefox-launcher "1.1.0"]
beginning of my file running all tests:
(ns app.run-all
(:require
[doo.runner :refer-macros [doo-tests]]
[pjstadig.humane-test-output]
here is reason I use forked version: https://github.com/bensu/doo/pull/176 (maybe karma-reporter
improved since then - I don't know)@U662GKS3F How do you invoke it?
I use the leiningen plugin: https://github.com/bensu/doo#plugin
I've created 2 aliases in project.clj
:
"test" ["with-profile" "test" "doo" "node" "once"]
"test-watch" ["with-profile" "test" "doo" "node"]
so when I am developing, I invoke it via $ lein test-watch
, on ci
I use $ lein test
Ups. I don't think it will work with shadow-cljs
I guess this is true for all frameworks re-frame/fulcro etc: When do you load the data from the backend? Say I have a main page where there are some navigation links (anchors '<a href=',) or on-click handlers that dispatch reframe events which navigate to the view (through accountant/secretary). The first load of data was during the page load. When and how do I load the data afterwards so that I can populate it in the appdb which will be rendered in the view?
Bare in mind that if you dispatch on-click, you want to be careful because you need to fire the http request even when the user is on the page and simply refreshes 馃槈
You could use a reagent form 2 component and dispatch on mount.. and maybe you could wrap it around a when-not data-fetched? to do it just once rather than every single time the component is mounted
I鈥檇 say you usually load data when switching to a certain view, so your router have to dispatch an effect that would load data for that view. Because event dispatch is bound to navigation change, this will always work no matter in which way navigation was triggered.
@UE35Y835W yes, the when-not data is what I am thinking to do. My main concern in when and how should I dispatch the event to fetch the data. @U0FR82FU1 Yeah this could solve the problem. But this is gonna fetch the data everytime i switch view (say i am in one tab and jump to another tab and back again, it will make 3 calls to backend). Is that normal?
@U3MRWH35M This depends on your application. If you load data that could have been changed it鈥檚 better to load it anyway. Doing any kind of smart caching on the client would introduce unnecessary complexity.
I agree with Roman.. I would take into account: - the rate at which the data changes - is there any expensive computation back-end side? - usefulness of the data you are displaying for the end user
backend should have caching in the first place btw
I am new to firebase, but it seems like there is a way where firebase lets me know when the data is updated in the backend.
firebase is a real time db, so you do have access to real time updates
which means you don鈥檛 have to load data explicitly, just subscribe to collections in the db and push data into application state
Thanks @U0FR82FU1 I will try to implement that
if you wanted to get fancy, you could pre-empt the click by dispatching a prefetch event + fx to load the data on hover
Does anyone know if it鈥檚 possible use the Wordpress front end, (or create themes) I don鈥檛 really know how it works... Integrating with clojurescript?
@cybersapiens97 you can pretty much embed anything in a wordpress site. That said, one thing you may want to be aware of is overall bundle size of your pages.
What do you mean by bundle size @oconn
This could possibly mean cljs not being well suited for it? I really wanted to start freelancing Wordpress but using cljs :(
No I wouldn鈥檛 say that at all - with advanced compilation you can get your projects way down in size. The reason I mentioned watching your bundle size is because I鈥檝e seen a bunch of Wordpress sites that suffer from bloat.
Oh gotcha
Thanks