Fork me on GitHub

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 ?

Roman Liutikov09:07:58

@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?

Roman Liutikov09:07:57

@jaihindhreddy yes, Closure Compiler will include polyfills

馃憤 4
Roman Liutikov09:07:22

but for that you have to add compiler option :rewrite-polyfills true


Is there a way to access build id at compile time, or would I use a closure define?


Yeah, I would use goog-define for soemthing like that.

Karol W贸jcik17:07:55

Do you know some of the test reporters which work seamlessly in node.js environment with cljs.test?


I use doo ( with humane-test-output ( Here is my part of my :test profile in leiningen:

   {:dependencies [[pjstadig/humane-test-output "0.8.3"]]
    :plugins [[org.clojars.nenadalm/lein-doo "0.1.11-SNAPSHOT"]
              [lein-cljsbuild "1.1.7"]]
      {:source-paths ["src" "test"]
       :compiler {:main
                  :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:
   [doo.runner :refer-macros [doo-tests]]
here is reason I use forked version: (maybe karma-reporter improved since then - I don't know)

Karol W贸jcik20:07:22

@U662GKS3F How do you invoke it?


I use the leiningen 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

Karol W贸jcik19:07:05

Ups. I don't think it will work with shadow-cljs


I've never used that. So I have no idea.


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 馃槈


What is the correct way of handling that scenario here?


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

Roman Liutikov08:07:49

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.

馃憤 4

@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?

Roman Liutikov14:07:17

@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.

馃憤 12

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

馃憤 4
Roman Liutikov15:07:26

backend should have caching in the first place btw


Its a firebase application. So the backend is essentially just a data store


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.

Roman Liutikov15:07:48

firebase is a real time db, so you do have access to real time updates

Roman Liutikov15:07:36

which means you don鈥檛 have to load data explicitly, just subscribe to collections in the db and push data into application state

馃憤 4

Thanks @U0FR82FU1 I will try to implement that


in re-frame, I would use an effect to load the new data from the navigation event


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


The overall size of your generated JavaScript files.


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.


If you鈥檙e bolting a CLJS project on top of a bunch of plugins and other frameworks and what not. No problem.