Fork me on GitHub
#clojurescript
<
2022-01-29
>
tianshu10:01:28

Is js/BigInt the recommended for big integers in ClojureScript? But it seems not being supported by transit, and in transit spec, there's a BigInteger, however I couldn't find what type in ClojureScript(I know there's a BigInteger in Clojure)?

p-himik10:01:22

A small correction - BigInteger exists in Java, not in Clojure. But clojure.core has a function biginteger. Similarly, JavaScript has BigInt, but CLJS does not have biginteger. I don't know for sure why but my bet is that's because BigInt is a relatively recent addition - e.g. in Firefox it has been implemented a little more than 2 years ago. And I guess that's also the reason why it's not supported in Transit. With that being said - yes, you should use js/BigInt for big integers if all your target platforms support it. And you can enable Transit to read and write it with custom handlers - it's designed for extensibility.

tianshu10:01:03

How can I enable it in transit, I could not figure out its type.

tianshu10:01:34

Sorry, I think I'm wrong. I can extend it now.

tianshu10:01:40

Thank you!

👍 1
Chase19:01:23

I'm getting some console errors when I try and submit a form but the submit action also immediately reloads the entire page, thus erasing the console messages. How can I see those error messages? Shadow-cljs doesn't show any errors

phronmophobic19:01:15

if you click on chrome's console settings. there's a "Preserve log" option

Chase19:01:21

That works perfectly, ty!