Fork me on GitHub
#clojurescript
<
2018-09-06
>
fabrao00:09:17

With this, I can send to browser download

(let [url (.createObjectURL js/URL (.getRecordingFile @msr))
        linkDownload (.createElement js/document "a")]
    (set! (.-href linkDownload) url)
    (set! (.-download linkDownload) "fernando.mp3")
    (.append (.getElementById js/document "app") linkDownload)
    (.click linkDownload)
    (.revokeObjectURL js/URL url)
    (.remove linkDownload)
    )
. Is there any way to automatic upload to ring url?

henrik03:09:29

@fabrao For file uploads with Ring, you should have a look at multipart-params. https://github.com/ring-clojure/ring/wiki/File-Uploads Include javax.servlet/servlet-api {:mvn/version "2.5"}, or it’ll complain of missing deps.

chrisetheridge09:09:55

is this valid regex in cljs/js \/+$ ?

chrisetheridge09:09:28

it prodcues this regex once compiled: /\\/+$/ which is not valid in JS

chrisetheridge09:09:38

it double escapes the /

kucerm212:09:00

Hi, how to annotate function which return string or nil ?

chrisetheridge12:09:34

how else would i create a regex like that, then?

mfikes12:09:42

@kucerm2 With ClojureScript type hints

(defn ^{:tag #{string clj-nil}} foo [x] (when x "a"))
and with spec
(s/fdef foo :ret (s/nilable string?))

mfikes12:09:33

Note that the next release of ClojureScript will infer this type hint for the foo example above.

mfikes12:09:58

@biscuitpants You could do it via interop: (js/RegExp. "\\/+$")

chrisetheridge12:09:10

ah yeah i thought to do that. thank you @mfikes

lilactown18:09:36

can anyone think of a clever way to import my tests into devcards?

bhauman19:09:07

@lilactown what are you envisioning?

lilactown19:09:54

e.g. I have a foo.bar-tests ns that currently is run in node.js and I want to import that into my foo.bar-devcards so I get a visual

lilactown19:09:56

ah interesting

bhauman19:09:30

yeah cljs-test-display is what you want

lilactown19:09:54

I'd prefer to have devcards + tests in one place but this might suffice

dpsutton19:09:13

in favor of using the separate test runner, we have tests in devcards on an older library of ours. and you have to navigate to all of the cards to see your tests run and scroll to see that they are all passing. the test runner does the favicon and notification popups of all tests all the time. quite nice

bhauman19:09:12

you mean cljs-test-display when you say test runner right?

dpsutton19:09:33

was trying to tell lilactown that my experience with them separate (and running concurrently) has been quite nice

lilactown19:09:28

noted 😄 I'll try it out with shadow-cljs. thanks!

Ramzi20:09:15

I can run chesire just fine with lein figwheel, but when I do the production build, it can't find chesire. What gives?

richiardiandrea21:09:32

so I have just discovered I cannot do the following, is it expected:

(goog-define CLOUD-PROVIDER "none")

(def ^{:dynamic true}
  *cloud-provider* CLOUD-PROVIDER)

richiardiandrea21:09:03

it looks like the value of *cloud-provider* is not set by the goog-define

dnolen21:09:54

it should work

dnolen21:09:08

how is this different from any other usage of goog-define?

richiardiandrea21:09:09

I don't know 😄 I though it would work, trying a couple of things

richiardiandrea21:09:11

it seems like it is working, but for some reason when I println the values of the two, they differ...

mfikes22:09:59

@richiardiandrea might be worth looking at js/CLOSURE_UNCOMPILED_DEFINES

mfikes22:09:18

See what is in that object

mfikes22:09:37

Make sure there is a “some.namespace.CLOUD_PROVIDER”

richiardiandrea22:09:23

yep it is there actually, I am now checking the value

richiardiandrea22:09:25

maybe it was a false alarm, now everything seems ok

richiardiandrea22:09:52

I swear I have seen the dynavar different from the goog-define, but now I cannot reproduce

richiardiandrea22:09:17

but thanks for the trick 😉

mfikes22:09:14

No prob. You can even alter it via

(set! js/CLOSURE_UNCOMPILED_DEFINES #js {"cljs.user.CLOUD_PROVIDER" "a"})

👍 4
mfikes22:09:32

To do that, you’d need to re-evaluate

(goog-define CLOUD-PROVIDER "none")
and things that depend on the value. Normally you wouldn’t do stuff like this, but it illustrates the mechanism

👍 4
richiardiandrea23:09:59

so this basically does the set! as side effect am I right?

mewa22:09:12

Hello everyone, does anybody know how to include custom attributes in reagent? I know it wasn't possible due to React limitations, but with React 16 these limitations have been lifted and reagent 0.8.1 uses this new version.