Fork me on GitHub
#code-reviews
<
2019-07-24
>
dmaiocchi07:07:58

You could create a higher function where you take as arg state and modification func as 2nd parameter (set and sync)

👍 4
dmaiocchi07:07:24

So modifystaye(state modifystate) modifystate is a func

dmaiocchi07:07:40

But is more a style thing imho is good otherwise!

dmaiocchi07:07:10

You could use let to improve readability

jayesh-bhoot11:07:18

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.

dmaiocchi13:07:08

@jysh imho, what can be improve also, is the (.set) interoperability with clojurescript

dmaiocchi13:07:18

I have not used clojurescript sofar but http://cljs.github.io/api/cljs.core/setBANG

dmaiocchi13:07:11

imho in theory you should the .functionNative when needed and take what is already there

dmaiocchi13:07:07

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 😁

dmaiocchi13:07:38

but if you have primitive in clojurescript that does the same thing, i would personally prefer them. hope it helps

dmaiocchi13:07:13

I think core async is best in clojurescript

jayesh-bhoot13:07:15

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.

dmaiocchi13:07:37

In clojure one could rely also on Java queue

jayesh-bhoot13:07:45

So I couldn't have used the cljs native set! here

dmaiocchi13:07:05

But in Javascript afaik there isnt such primitives that is really cool

dmaiocchi13:07:29

So mentally typo:grin:

jayesh-bhoot13:07:57

> I think core async is best in clojurescript I agree. I an already itching to replace my current implementation

clj 4
dmaiocchi13:07:17

A OK thx for clarification about set! Discovered something new

👍 4
jayesh-bhoot13:07:50

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

cider 4