Fork me on GitHub
#clojurescript
<
2019-11-18
>
borkdude15:11:03

Does a patch like this work well with (advanced) compilation?

(when-not #?(:clj (resolve 'ex-message)
             :cljs (exists? ex-message))
  (defn ex-message [ex]
    (when (instance? #?(:clj Throwable :cljs js/Error) ex)
      #?(:clj (.getMessage ^Throwable ex)
         :cljs (.-message ex)))))

Alex Miller (Clojure team)16:11:50

ex-message exists in clojure now btw

Alex Miller (Clojure team)16:11:41

so in this particular case, you can just use ex-message portably

borkdude16:11:00

the tool this is going to be in, has to support clojure 1.9 as well

papachan16:11:26

Where i can find some examples with clojurescript for pre conditions types with a basic foo object.

(defn foo [x y]
  {:pre  [(map? x) (or (number? y) (string? y))]
  ;
)

Aleks Abla17:11:19

hey everyone, hope the week has been off to a great start -- I am trying to add a dropdown component to my website. it would open on click and would have a couple of options that to choose from. any suggestions/resources on how i could implement this?

Aleks Abla03:11:59

yes exactly.. except the hamster haha

papachan17:11:32

Something like this should work:

(defn foo [a b]
  (toString [this] (str a ", " b)))

(s/fdef foo
  :args (s/cat :a string? :b string?)
  :ret string?)

(deftest mytest
  (stest/instrument `foo)
  (testing "unstrument in finally works"
    (is (= "John Smith" (foo "John" "Smith"))))
  (stest/unstrument `foo))

❤️ 4
borkdude17:11:33

@ablazevix selectize is a popular option (do you notice the pun?)

Aleks Abla18:11:38

Nice one hah!

Aleks Abla22:11:41

Hey again, I've been continuing to work on the small app, and would love to have get some advice. I am trying to make an app that lets you send emails to people. The idea is that you specify an option, input name and email. Then this gets saved into a table, from which later the emails get sent. Here's a mockup

Aleks Abla22:11:30

I've got some code going, but I am struggling with adding things into a table. I am not sure how to translate the text inputs into the table. My idea is that once names are inputted in the lines, and the person has clicked on the option, the button add to sendees can get triggered in which instance the table gets populated.

Aleks Abla22:11:57

Here's my code for views as of now.

isak22:11:41

@ablazevix sounds pretty similar to TodoMVC, I would check out the re-frame example: https://github.com/day8/re-frame/blob/master/examples/todomvc/src/todomvc/views.cljs

Aleks Abla22:11:39

@isak Awesome, thanks for the tip! 🙂