Fork me on GitHub
#clojurescript
<
2017-07-03
>
melindazheng07:07:46

Singapore Clojure Meetup tomorrow night, welcome to join. https://www.meetup.com/Singapore-Clojure-Meetup/events/240601551/

len09:07:47

For testing cljs during CI is this a good way to go https://github.com/bensu/doo ?

serkanozer11:07:50

Is it possible to globally intercept http requests/responses in https://github.com/r0man/cljs-http/ ? Is there any other cljs lib provides that

theasp13:07:11

Hello, is there some trick to getting debugf from timbre working in node.js now? infof works, and debugf was working a few weeks ago for me.

pesterhazy13:07:27

@theasp guessing here...

(set! js/console.debug js/console.log)
?

tankthinks13:07:10

What’s a good way to mock out external javascript libraries during unit tests?

theasp13:07:34

@pesterhazy Awesome, that did it, thanks!

tankthinks13:07:34

My question is pretty ambiguous. I’ll give a more concrete example. I’m trying to test a function that calls a js library like so (.view obj {}). In Clojure, I would use

(defprotocol Viewable
  (view [v]))
(defrecord SpyViewable [called]
  Viewable
  (view [_] "viewed"))

(.view (SpyViewable. {}))

tankthinks13:07:13

In this example, in ClojureScript, I cannot call the view fn with the dot notation .view.

tankthinks13:07:17

Is there a way to do this in ClojureScript?

sundarj14:07:34

are you trying to call the method of a javascript object?

rauh14:07:22

@tankthinks

(let [o (reify Object (view [x] :hmm))]
  (.view o))

rauh14:07:06

You can also say (deftype X Object (view [x] ...)).

bhauman14:07:13

there really needs to be a meta-guide on javascript objects and clojurescript objects/protocols and the mechanics of their relationships

len14:07:25

Re testing clojurescript apps - are there any recommendations along the lines of karma or something ?

tankthinks14:07:18

That would definitely help me @bhauman, though I must admit that I know the JVM better than JavaScript, so I may just be ignorant of the details.

tankthinks14:07:16

It abstracts out the JS environment; that way you can run on phantom, slimer, chrome, etc

len14:07:30

aaah right

len14:07:43

thats useful, will dig in

tankthinks14:07:44

it’s a good place to start

fbielejec21:07:31

Hi, I've been scratching my head for a while already with this one, it's an extern / umd related problem - how to use a webpack compiled library (umd) in cljs? I posted the question with code samples on SO: https://stackoverflow.com/questions/44893233/using-webpack-compiled-library-as-external-in-cljs

didiercrunch22:07:09

Hi there, I am wondering if someone knows a way to jsonify a data structure that contains namespaced keyword into json that keeps the namespaced in the strings. clj->js only keeps the name of the keywords.

dohxis22:07:16

Hello is there a channel for newbies to get some help? 🙂

danielcompton22:07:19

@len we use Karma directly for CLJS testing in CI

didiercrunch22:07:04

@dohxis I use here... we are all newbies in a way or in another

dohxis22:07:02

I am just playing around with clojurescript and I am trying to do something strange and I dont even know if its possible. Here is a little example what I am trying todo

sundarj00:07:54

dohxis: you should just be able to do

(def functions {:inc inc :dec dec})

((get functions :dec) 5)

sundarj00:07:33

or, ofc

(def functions {:inc inc :dec dec})

((:dec functions) 5)

didiercrunch22:07:34

you should use partial function

didiercrunch22:07:59

it should end up in something like

(def functions {:increment (partial inc) :defrement (partial dec)})

((get functions :increment) 1)
=> 2

dohxis22:07:12

wauw thanks that really worked! 😃

didiercrunch22:07:00

my turn to ask a newbie question, why does some variable are surrounded by asterisks. for instance *anti-forgery-token* in some ring modules.