Fork me on GitHub
#clojurescript
<
2022-11-10
>
agorgl17:11:33

Hello! First time interop'ing with js in cljs, I installed this qrcode library: https://github.com/soldair/node-qrcode with npm. I then did add it to my :require list as:

(:require
   ["qrcode" :as qr]))
Adding (qr/toDataURL "hello there" #(println "CALLBACK" %)) somewhere, lead to CALLBACK nil in the console Any ideas?

dvingo17:11:51

QRCode.toDataURL('I am a pony!', function (err, url) {
  console.log(url)
})
looks like it's working try replacing % with %2 to get the url

agorgl17:11:31

Damn you are right

agorgl17:11:59

For some reason I thought that % in cases of multiple arguments gets [%1 %2..]

p-himik20:11:40

That would be %&. :) But it would also be nil if there are no arguments passed to such a lambda. With that being said, if a lambda takes more than one argument, you should probably avoid the #(...) shortcut and instead use (fn [...] ...).

Stefan21:11:14

Hi all! I'm trying to use jest for testing my (react-based) clojurescript web app. I've got it mostly working, except for one thing: rerunning tests on changes. Jest determines changes based on git status, but in my case the test files are the files that are output by the compiler (shadow-cljs), hence they are in my gitignore and jest says that nothing has changed. So it's basically all or nothing: always rerun all tests (impractical) or it thinks there is nothing to run. Does anybody know of a solution to this problem? (@pesterhazymaybe? https://clojurians.slack.com/archives/C03S1L9DN/p1629265015441200?thread_ts=1629215985.430500&amp;cid=C03S1L9DN) Thanks!

pesterhazy16:11:25

I don't know a solution to the problem unfortunately

pesterhazy16:11:09

If jest were able to rerun based on timestamp, that would work

pesterhazy16:11:26

The whole setup of watching a folder containing build artifacts strikes me as brittle

pesterhazy16:11:03

But not sure how to fix it without writing your own test runner

pesterhazy16:11:31

Did you have any insights in the meantime?

Stefan18:11:33

Yeah it’s odd that it can’t run based on time stamps. I haven’t got a solution yet, but I’ll keep thinking about it. I’ll post here if I have any news.