Fork me on GitHub
#clojurescript
<
2020-03-23
>
annarcana09:03:30

I have a swap! call inside of a callback that never happens. Help?

annarcana09:03:58

I have an atom counts that's supposed to be counting successful onload events. I set a callback function that logs the event, and then increments the counts atom. The logging happens, so I know the callback is running, but the swap! never does, so the counts never increment.

annarcana09:03:28

are atoms not useable inside async events like this somehow? that doesn't seem right.

Akiz09:03:44

Hi, do you know about any CLJS library for OIDC? There is oidc-client for JS but I am not good in JS and its interop so I would prefer native CLJS library (which I cant find). Thanks a lot

Chris McCormick12:03:51

Does anybody know of a library that will take a <textarea> and return an atom, which when mutated will update the contents of the textarea? Kind of like how storage-atom will do the same for localstorage. I am building a Reagent UI on top of a Django admin form which has JSON blobs stored in text fields. Django handles the saving of the textareas so I want to make sure any changes the user makes to the structure of the blob in the UI are updated in the textbox for when they click 'save'.

Chris McCormick12:03:06

Wait a moment, I can just use reagent to re-render the textareas. facepalm

Chris McCormick12:03:15

Sorry for the noise.

roklenarcic17:03:19

I’m using a library for dates cljs-date and other stuff… so when I run in REPL:

(type (t/date))
=> #object[LocalDate]
How do I check for this type? I want to write a spec that checks if value is this cljs library’s date object and I don’t know what to put in instance? call.

Vishal Gautam17:03:16

(s/valid? inst? (t/date))

roklenarcic18:03:48

it’s not a js/date

souenzzo19:03:00

there is not a built-in t/date? predicate?

dvingo21:03:45

I assume you're using tick. I didn't see a predicate but you can do:

(= (type my-thing) (type (t/date))

dnolen18:03:37

@zikajk I don't know of a ClojureScript one but AppAuthJS works pretty well - somewhat poorly documented but they have a complete working example and that was enough to figure it out. the API surface is pretty small - working directly against it would be straightforward - and it making prettier would be pretty trivial