Fork me on GitHub
#clojurescript
<
2018-04-27
>
sova-soars-the-sora12:04:27

firebase is super groovy. matchbox is cool, still wrapping my head around it. anybody play with it much?

rickmoynihan13:04:27

How do I extend a protocol to an arbitrary map like thing in clojurescript? In clojure I can do (extend-protocol Foo java.util.Map (foo [o] :foo)) Am I right that this isn’t possible because javascript doesn’t have interfaces or abstract classes?

conan13:04:25

Does anybody know what the uuid function does when passed a UUID?

(def u #uuid "d70cbe71-c811-441a-988f-0348bdef14f9")
=> #'cljs.user/u

u
=> #uuid "d70cbe71-c811-441a-988f-0348bdef14f9"

(uuid u)
=> #uuid "d70cbe71-c811-441a-988f-0348bdef14f9"

(= u (uuid u))
=> false

(type u)
=> cljs.core/UUID

(type (uuid u))
=> cljs.core/UUID
somehow it changes an input UUID into another UUID which has the same serialisation but is not equal

conan13:04:20

or is this some weird javascript equality thing

souenzzo13:04:03

@conan on lumo 1.8/cljs 1.9.946 (uuid u) throws Assert failed: (string? s) and (= u (uuid (str u))) ;; => true

conan14:04:00

that makes sense because the source is:

(defn uuid [s]
  (assert (string? s))
  (UUID. (.toLowerCase s) nil))

conan14:04:23

i'm surprised it doesn't blow up even if i don't have assertions running

thedavidmeister15:04:10

is there a way to get a global fn?

thedavidmeister15:04:18

as in, outside any namespace, in cljs

sveri15:04:06

I am trying to replace some jquery code with google closure code: (.on (js/$ js/document) eventType (fn [e]...) by (events/listen js/document (get keyword->event-type event-type (fn [e]...) My problem is, the handler function is now executed on the pageload instead when pressing a key. Is there some caveat when replacing .on by events/listen?

thedavidmeister15:04:47

i don't think it's a drop in replacement

sveri15:04:11

Yea, I have the same feeling too. Whats the correct way to use goog.events?

thedavidmeister15:04:37

i stopped trying to replace jquery events

thedavidmeister15:04:55

if you figure it out let me know

thedavidmeister15:04:45

i suspect they aren't supposed to be DOM events, but a general event system

thedavidmeister15:04:58

but last time i checked there was basically no docs on it

thedavidmeister15:04:17

so i've got some third party code that calls global functions

thedavidmeister15:04:24

like onFoo() kind of

thedavidmeister15:04:57

how do i do (defn onFoo ...) so that it shows up globally rather than in the current namespace?

mfikes16:04:44

@thedavidmeister I suppose you could do something like (set! js/onFoo (fn [x] (inc x)))

thheller16:04:35

@thedavidmeister @mfikes if you want something that also works with :advanced you should use (defn on-foo [] ...) (js/goog.exportSymbol "onFoo" on-foo)

thheller16:04:13

set! is a bit dangerous in some scenarios (eg. :output-wrapper true)

👍 4
yorggen19:04:01

hello, does anyone know a good cljs wrapper for parallel.js? if not, can someone point to a nice guide on how to make a “good” cljs wrapper?

eoliphant19:04:45

Hi, shouldn’t this (number? ##NaN) be false?

mfikes19:04:55

No, ##NaN is still a number

ajs10:05:14

The irony that something which is explicitly not a number by its very name, is in fact actually a number.

mfikes11:05:33

Yeah, we've been living with that since 1985. 🙂

mfikes19:04:37

js/isNaN might be of interest

eoliphant19:04:48

yeah already added it to my logic

eoliphant19:04:51

was just wondering 🙂

favila20:04:50

what do people do for running cljs.test tests and collecting output in junit (for jenkins)?

ajs10:05:14
replied to a thread:No, `##NaN` is still a number

The irony that something which is explicitly not a number by its very name, is in fact actually a number.