clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
thheller 2021-04-09T06:44:36.039600Z

closure-defines control nothing related to source maps. CLJS currently does not support this I believe. there are a couple open issues in Jira regarding this IIRC. shadow-cljs does support this and does it by default.

2021-04-09T06:53:05.039800Z

thanks, I came to the same conclusion

zendevil 2021-04-09T08:16:34.042900Z

Hi, I’m implementing Apple Sign In in React Native using this library: https://github.com/invertase/react-native-apple-authentication And there’s a handler for the onPress event of the Apple Sign-In button given like so: https://gist.github.com/zendevil/704508e46017910cfcdfda28768e89ec However, when I convert this to clojurescript like so: https://gist.github.com/zendevil/9b6a6f7a65351ead4cac5759eb051cdd I’m getting the following error: https://gist.github.com/zendevil/f2fa1d09f3946cdbf2bdb04f8d687612 How can I fix this error?

zendevil 2021-04-09T08:26:47.043900Z

I also tried doing this: https://gist.github.com/zendevil/86ed457dea608d3a2c5cde04b40b4b8f But that gives: “RNAppleAuth.AppleAutRequestOptions ‘requestedScopes’ must be an array value if provided.” And removing ‘requestedScopes’ gives a “Promise error”.

2021-04-09T13:46:59.046500Z

hello, does anyone know if there a way to detect the compiler version (or closure version) and branch code depending on that? i'm trying to work out how to cope with the https://clojurescript.org/news/2021-04-06-release in a backwards compatible way, namely decide whether to use goog.debug.Logger.Level.SEVERE or goog.Logger.Level.SEVERE

rakyi 2021-04-09T13:50:30.046600Z

without knowing the cljs/closure compiler specifics, I’d assume (exists? goog.Logger) could be one way to find out if you are on the newer version

lilactown 2021-04-09T13:58:33.046800Z

I think you were close with this solution

lilactown 2021-04-09T13:59:06.047Z

you need to add a #js in front of the the [ bracket in

[(.. appleAuth -Scope -Email)
                                                       (.. appleAuth -Scope -FULL_NAME)]

lilactown 2021-04-09T13:59:45.047200Z

right now it's sending a CLJS vector, when it expects a js array. a way you create one is via #js []

lilactown 2021-04-09T14:00:39.047400Z

this looks like the clj->js call is coercing the EMAIL and other special values into invalid things. writing out the JS data structure by hand is probably the smartest thing to do

nilern 2021-04-09T14:02:20.047600Z

That is probably more robust than reading the version anyway.

2021-04-09T15:29:24.047800Z

ah perfect, thank you i didn't know about exists? . it looks to be exactly what i want

athomasoriginal 2021-04-09T16:05:27.049Z

Take a look in figwheel-core repo. I believe bhauman just solved the problem your looking at. Could be insightful

👍 1
zendevil 2021-04-09T17:07:28.049200Z

@lilactown I tried this:

(.performRequest appleAuth
                                   #js {:requestedOperation (.. appleAuth -Operation -LOGIN)
                                        :requestedScopes #js [(.. appleAuth -Scope -Email)
                                                              (.. appleAuth -Scope -FULL_NAME)]})
But that still gives me NSMutableDictionary cannot be converted to ASAutorizationAppleIDRequest

2021-04-09T17:38:04.049500Z

Interesting, he used the clojurescript version (which is available, it turns out). But presumably, although unlikely, the Google closure version can differ from the default one if someone excludes the dep and uses their own version. Here's the code in figwheel-core for anyone interested https://github.com/bhauman/figwheel-core/commit/c51aee22b7d28221df67b7d7848fd2ed80df2528#diff-9714a71e9563e0ef626cd84f6f767ebefe31aa5cead69c25bf4ce8c0f3e634fbR122

sova-soars-the-sora 2021-04-09T18:18:59.051200Z

have a rum component that displays 3 strings from a collection of strings. in my on-click for the component,

{:on-click (fn [_] (do
				(reset! names-wedge  (take 3 (shuffle names-quiz-terms)))))}
this will cause an infinite loop where the reset! happens over and over again. can i prevent such loops from happening? I run into this behavior sometimes, could someone help clarify how to prevent this or what's going on?

dpsutton 2021-04-09T18:24:39.052Z

do you have any other resets to names-wedge? this doesn't seem like it should cause an infinite loop.

1
sova-soars-the-sora 2021-04-09T18:32:19.052500Z

ooh yes there is.

sova-soars-the-sora 2021-04-09T18:41:17.052700Z

Thank you that was it ! 😃

sova-soars-the-sora 2021-04-09T18:41:33.053100Z

there was a (reset!) in the body of the component ... just hanging out