This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-24
Channels
- # announcements (5)
- # beginners (184)
- # calva (32)
- # cider (29)
- # clj-kondo (1)
- # cljdoc (29)
- # cljsrn (6)
- # clojure (44)
- # clojure-dev (36)
- # clojure-europe (9)
- # clojure-italy (18)
- # clojure-losangeles (1)
- # clojure-nl (3)
- # clojure-spec (7)
- # clojure-uk (30)
- # clojure-ukraine (1)
- # clojuredesign-podcast (8)
- # clojurescript (65)
- # code-reviews (21)
- # core-async (25)
- # cursive (51)
- # data-science (3)
- # datascript (2)
- # datomic (25)
- # emacs (14)
- # events (1)
- # figwheel-main (3)
- # fulcro (3)
- # graalvm (5)
- # jackdaw (17)
- # kaocha (14)
- # luminus (5)
- # off-topic (17)
- # pathom (7)
- # pedestal (2)
- # re-frame (71)
- # reagent (25)
- # shadow-cljs (83)
- # spacemacs (31)
- # sql (92)
- # tools-deps (23)
- # vim (102)
- # xtdb (5)
Hi. Any improvement tips for my first ever clojurescript code? https://github.com/jayesh-bhoot/enforce-browser-fonts/blob/master/cljs-version/src/ebf/bg.cljs
You could create a higher function where you take as arg state and modification func as 2nd parameter (set and sync)
So at least I am on the right track! I have kept the code as it is for now, and will integrate the higher order functions as I learn more.
@jysh imho, what can be improve also, is the (.set
) interoperability with clojurescript
I have not used clojurescript sofar but http://cljs.github.io/api/cljs.core/setBANG
imho in theory you should the .functionNative
when needed and take what is already there
e.g with clojure, .Foo
is most of the time wrapped in a constructor of clojure which read more the clojureway , so it is more avoided then used. It is used when needed mostly 😁
but if you have primitive in clojurescript that does the same thing, i would personally prefer them. hope it helps
Regarding .set
, instead of a simple variable assignment, its an asynchronous set operation, returning a Promise. As in its not exactly a standard JS assignment, but a weird Mozilla API design.
So I couldn't have used the cljs native set!
here
> I think core async is best in clojurescript I agree. I an already itching to replace my current implementation
Check this for more clarification - https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserSettings/useDocumentFonts#examples Its an API specific thing. Makes one pull their hair out. 😁