Fork me on GitHub
#clojurescript
<
2015-12-21
>
pat00:12:26

@mfikes I am not, but do I need to be? to use js-interop would make sense

mfikes00:12:27

@pat Using master as a quick test might be good. Are you using bootstrap or regular JVM-based ClojureScript?

pat00:12:58

regular JVM, figwheel into a node repl

mfikes00:12:51

@pat In that case, your macros file will be compiled as Clojure (the :clj branch of reader conditionals will be used). Also, master is unlikely to matter in that case, as the JVM-based macro system is mature.

pat00:12:21

The macro code itself is called, if you put a log statement in there it reads out

pat00:12:13

so i figure it just doesn't like js/error. I will try bootstrapping, sounds like a good enough excuse šŸ˜‰

clumsyjedi00:12:24

I am trying to compile some clojurescript inside a nodejs process. I have followed the tutorial (https://github.com/swannodette/cljs-bootstrap) for cljs-bootstrap and I believe my setup is good, the analyze-keyword example from the wiki works. But what I really want to do is eval functions. I canā€™t quite figure out the magic incantation to make that happen - any pointers? Right now I am trying

(js/eval
  (with-out-str
    (c/emit
      (ensure
        (ana/analyze-fn-method
          (assoc (ana/empty-env) :context :expr)
          []
          '([] 1)
          nil)))))
Which results in throw (new Error([cljs.core.str("No method in multimethod '"),cljs.core.str(na

mfikes00:12:38

@pat Well the bit that throws in with-open is at compile time. You can probably use clojure.core/with-open. Your macro appears to be prepared for use in bootstrapped environments, though :)

pat00:12:03

@clumsyjedi: i think that was pre-1.7, may want to see his blog post on this

mfikes00:12:04

@clumsyjedi: recommend using the shipping cljs.js namespace

clumsyjedi00:12:10

ok thanks. I had been playing around using eval-str from cljs.js but kept getting undefined method: cljs.core.defmacro.call errors

clumsyjedi00:12:24

Iā€™ll have a look for a blog post then

clumsyjedi00:12:45

thatā€™s great - thanks @pat and @mfikes

mfikes00:12:23

See the examples in the comment at the bottom of cljs.js

pat00:12:31

@mfikes: cljs/core excludes with-open, do you suggest aliasing it in my macros file?

mfikes00:12:20

@pat ahh. Ok. Perhaps it isn't available in ClojureScript. Makes sense given lack of I/O.

pat00:12:43

@mfikes: I'm working on that!

pat00:12:50

ahh thats javascript core right

mfikes00:12:36

@pat: yes. My experience with Node is limited to using Replum (Elbow repo)

pat00:12:33

Node has the easiest AWS sdk, clojurescript is great with it but serialization is a pain

jaen10:12:19

Oh, cool

dominicm11:12:41

Any predicates for checking if something is metadatable in clojurescript? (satisfies? cljs.core.IMeta [1 2 3]) (implements? cljs.core.IMeta [1 2 3] have come back false thus far.

danbunea11:12:53

Hi, I'm trying to write a test for a simple reagent component, with a textbox: (defn choose-city-component [] (let [inner-state (r/atom {:text ""})] (fn [] [:div [:input#txt_city { :type "text" :value (@inner-state :text) :on-change #(swap! inner-state assoc :text (-> % .-target .-value)) ... (deftest choose-city-component-test-out ;;GIVEN render component in test (let [comp (r/render-component [w/choose-city-component] (. js/document (getElementById "test")))] ;;WHEN changing the city (let [$txt_city ($ :#txt_city)] (val $txt_city "london") (trigger $txt_city :change ) basically rendering the component in a div, then usign jquery (jayq) tring to simulate an on-change on the text box. Can anyonw come with a better idea? Thank you

dominicm11:12:17

(satisfies? IMeta [1 2 3]) works. Okay. Well. Back to work.

anmonteiro12:12:21

does Clojurescript use ^IPersistentMap type hints in functions?

spacepluk13:12:33

@dnolen about the sourcemap problem yesterday, I'm stupid and I forgot to set the stackTraceLimit so I was missing the important part for some of the errors facepalm

dnolen13:12:04

@spacepluk: ok, glad to hear itā€™s not a deeper issue simple_smile

dnolen13:12:46

@anmonteiro: thereā€™s very little reason to use type hinting in CLJS - the only one that really matters is ^boolean

dnolen13:12:44

@anmonteiro: there are a couple of other things but they are a bit subtle to explain and are less likely to contribute to perf gains

spacepluk13:12:28

@dnolen yeah me too hehe

borkdude14:12:01

Wow, this is a pretty awesome use case of clojurescript: https://www.cljs4excel.com/examples/k-means/k-means.gif

grav14:12:22

Oh, the joy of browsers.

grav14:12:58

This works in pre-el capitan Safari: var r = new XMLHttpRequest(); r.open("GET",""); r.setRequestHeader("foo","bar ā€œ); It throws a DOM exception in Safari on El Capitan 10.11.1 and 10.11.2

grav14:12:15

Any thoughts on whether itā€™s a bug or a feature?

grav14:12:51

(The reason for the exception is the trailing space in ā€bar ā€œ

grav14:12:08

Works in all other browsers that Iā€™ve tested

juhoteperi15:12:27

@denik: Merged & deployed

denik15:12:42

@juhoteperi: šŸ˜„ thanks!!

glenjamin18:12:29

Can anyone point me towards a guide for taking a React component from npm, and including it in a cljs project?

glenjamin18:12:33

or how to take a UMD file, and use it - that would do for now?

glenjamin19:12:45

ah, looks like iā€™d have to create cljsjs packages to make it work effectively

mattly19:12:05

@glenjamin: there is lein-npm for pulling in npm dependencies: https://crossclj.info/doc/lein-npm/latest/index.html

mattly19:12:43

I canā€™t speak to the ease of pulling in UMD modules.. the JS ecosystem is a complete cluster there to begin with

glenjamin19:12:11

I forgot to say, this is for browser JS. These days with webpack I can pull in components really easily - but cljsjs seems to be the closest equivalent

mattly19:12:00

cljsjs also adds some hints for the closure compilerā€™s optimizer

glenjamin19:12:48

Yeah, I think I could create my own jars that depend on cljsjs bits

glenjamin19:12:25

I tried adding a foreign-libs section to my build and figwheel started NPEing, so left it for now

glenjamin19:12:09

For reference, it's https://github.com/jhudson8/react-chartjs I was wanting to try out

firinne23:12:16

Hey all, Iā€™m pretty new to the clojure world as a whole but was impressed enough by what I read of datomic and what I saw of om that I wanted to move over this way for a long-term project Iā€™m starting. Iā€™m running into quite a bit of trouble though figuring out how I can deploy (in the simplest way) a single page clojurescript app which persists data with datomic. Iā€™ve spent about 5 weeks of full time work learning clojure, clojurescript, om-next, compojure/ring, and datomic itself, and have gotten some basic things working on my local machine ā€” even have been able to use docker to deploy some non-persisting learning exercises or simple sql dbs via uberjars, but Iā€™m feeling a little stuck right now, since the only example Iā€™ve seen that tie together datomic and om-next is @dnolen's todo mvc, which both uses @stuartsierraā€™s component system and some dependencies that donā€™t appear to be available from clojars. I havenā€™t found any books ā€” or detailed walkthroughs that tie these things together, and donā€™t personally know anyone I can ask for help. Iā€™ve gotten to the point that I have a datomic free transactor running on docker, and have a hostname for that I can connect to, but when I set my production hostname to match that, I get an error that the connection has timed out when Iā€™m trying to compile the uberjar. I was trying to escape this through a try catch block, but no luck yet. Does anyone have an example of the minimum Clojurescript/Datomic deployable example ā€” or even just a list of the things I need to be able to do to have a different uri for production/deployment. Iā€™m sure this is a noob question, but Iā€™ve got a lot of gaps in my knowledge and trying to fill them in gradually while still being able to put something basic on the web.

dnolen23:12:18

@firinne: thatā€™s just too many questions none of which everyone will know all of the answers to

dnolen23:12:29

for Datomic stuff ask in #C03RZMDSH

dnolen23:12:39

for Om stuff ask in #C06DT2YSY

dnolen23:12:52

the general ClojureScript deployment questions can be directed here

firinne23:12:27

ok, maybe the better question is. Has anyone written down a list of all the things a person needs to learn to get hello-world on the web with datomic and clojurescript

roberto23:12:28

I doubt it. I donā€™t believe there are many people interacting with datomic directly from cljs

roberto23:12:57

it is like asking if you can query postgres directly from ember/angular/react/backbone etc

roberto23:12:51

I havenā€™t used datomic, but if I were to use it, I imagine I would go about doing the same thing I do with any other database.

firinne23:12:59

@roberto: yeah, thatā€™s why I tried to learn compojure/ring as well

roberto23:12:00

provide an API to the front end

dnolen23:12:10

@firinne: I know people are playing around with Datomic integrations in the #C06DT2YSY channel so you might want to ask a more narrow question there as well

firinne23:12:36

@dnolen gotcha, thanks