Fork me on GitHub
#clojurescript
<
2015-06-24
>
bmay00:06:55

how did you find out about this?

owyn00:06:18

just ran across it at some point… seemed pretty cool

owyn00:06:32

i don’t think the dash is clojurescript though, looks like a standard ruby/js thing. reimann itself is written in clojure though.

stuartmitchell02:06:02

Hi all I want to use apply and (.log js/console) together I want the code to have the same effect as console.log("hello" "world"); but this doesn't work (apply (.-log js/console) "hello" "world") any ideas?

stuartmitchell02:06:26

to make my code easier to understand I want to avoid (.log js/console "hello" "world" ...)

yedi02:06:54

in om, is it a bad idea to keep my textarea state in local state?

yedi02:06:03

i'm trying to implement editing posts, and i stored the edit-text in localstate. I instantiate the local state with the text of the current post that should be edited. however if someone clicks another posts (client side routing), the edit box now has the text of the initial post instead of the new post. (also I store whether or not a post is being edited in localstate as well, so when I click a new post it still thinks im editing a post even though its a different post)

yedi02:06:50

do you guys have a better way of doing this, i'll have to do quite a bit of work to refactor the textarea text so that its stored in app-state instead of localstate

mikethompson02:06:05

@stuartmitchell: so what you are saying is that this works: (js/console.log "a" "b") But this does not: (apply js/console.log ["a" "b"]) In effect, js/console.log does not behave as a higher order function

mikethompson02:06:13

I have no solution, but i wanted to clarify your question (I've seen others run into this issue, but I don't remember the solutuon -- or if there was one)

jackjames02:06:28

@stuartmitchell: pretty sure this works so maybe you can find something useful in its study: https://github.com/circleci/frontend/blob/master/src-cljs/frontend/utils.cljs#L48

stuartmitchell02:06:31

thanks @jackjames (.apply (.-log js/console) js/console (clj->js ["hello""world"])) works

noprompt05:06:46

creating console helpers with defn is problematic if you care about source line numbers being reported correctly. for example calling the mlog function @jackjames linked will produce link to line 55 in that file in the console. the cljs println shares the same problem. when i call it it reports core.js line 100. shodan does not have this problem since it uses macros. as a result the correct line number as to where you called log in your source will be reported.

noprompt05:06:29

again this is only important if you care about it. personally, i care a great deal about accuracy when i'm debugging which is why i no longer wrap the console API with functions.

thomasdeutsch08:06:09

i am new to transit.cljs. What do i need to do, to transit a goog.date? (t/write transit-writer {:date (Date.) }) do i need a handler?

thomasdeutsch08:06:18

because this should be a default mapping - why is this code not working? I get the Error: "can not write"

thomasdeutsch09:06:14

ok i understand - because it is a goog.date, i need a handler. Found some info here: https://www.snip2code.com/Snippet/466340/Clojurescript-Transit-XHR-Handler

dnolen10:06:54

@thomasdeutsch: the transit-cljs wiki explains how to do this.

andrewmcveigh12:06:38

@dnolen: I’ve found some inconsistency in cljs.core/multi-arity-fn. The :arglists in :top-fn meta is a bit different to single arity/variadic.

andrewmcveigh12:06:55

Not sure if it’s a bug, or which is correct behaviour

andrewmcveigh12:06:39

But cljs.core/multi-arity-fn produces :top-fn {:arglists ([x] [x y] [x y z])…} and it seems the others produce :arglists (quote ([x] [x y] [x y z])).

andrewmcveigh12:06:01

@dnolen: I can submit a ticket/patch… Is the behaviour for multi-arity-fn incorrect?

rauh13:06:49

@noprompt: You might also like my logging library: https://github.com/rauhs/klang . It uses macros a lot and reports local binding and line number etc.

dnolen13:06:40

@andrewmcveigh: sure but I would check there isn't one already.

andrewmcveigh13:06:59

@dnolen: I’ve had a look, there are a couple of issues about the same/similar thing. Both closed… seem to be kind of the same issue, but not dealing with multi-arity-fn. I’ll double check before submitting anything.

meow15:06:47

What difference is there between a :require of a Google Closure class like [goog.dom.ViewportSizeMonitor] versus an (:import [goog.dom ViewportSizeMonitor]?

meow16:06:32

@hmadelaine: I still have a few points of confusion. Before that, the EventType/ACTION misuse of the slash was a great tip.

meow16:06:24

In your example of (:import goog.Uri) how are you then able to reference it as simply (Uri.) with no namespace prefix? Or is goog not a namespace prefix in this context? Or is something magical happening?

meow16:06:53

In my example would there be any difference between these two forms:

(:import [goog.dom.ViewportSizeMonitor])
(:import [goog.dom ViewportSizeMonitor])
(dot versus space)

meow16:06:12

Just tried it and they are different.

meow16:06:03

Another thing I've only recently come to realize is that the :as option creates an alias in the current namespace in addition to the fully qualified library name, which is a bit different than, say, imports in python.

meow16:06:00

I've also seen code in the wild using (:require [goog.dom.ViewportSizeMonitor :as viewport-size]) which seems really confusing in this context.

Petrus Theron16:06:32

has anyone used mixpanel tracking from cljs? As I understand it, I just need to set up some externs.

wiruzx17:06:01

Hi everyone

wiruzx17:06:17

Have anybody deployed clojurescript in http://Parse.com?

meow17:06:45

@wiruzx: I haven't done it, but I'm familiar with tenzing, which is a boot tool, which lists http://parse.com as a target https://github.com/martinklepsch/tenzing

meow17:06:36

@martinklepsch: care to answer a http://parse.com question?

wiruzx17:06:04

@meow: thanks for the answer. I cannot find any information about usage tenzing with Parse. And I don't really want to add one more abstraction layer

wiruzx18:06:55

One more question: How to remove #!/usr/bin/env node hashbang?

:cljsbuild {:builds [{
                        :compiler {:output-to "resources/public/js/main.js"
                                   :target :nodejs
                                   :hashbang false}}]})
Doesn't work =(

aengelberg19:06:28

Is there a resource somewhere that explains exactly what type hints accomplish (if at all) in cljs?

noprompt19:06:36

@rauh: there's a lot of cool stuff in there. i'll check it out more when i have a chance.

shaun-mahood21:06:41

@wiruzx: Travis Vachon did a presentation on clojurescript with Parse at Clojure/West 2014 - https://youtu.be/a8has_eEka4

dnolen23:06:00

@meow: you have to realize that in Closure Library, namespaces often function as part of the API

dnolen23:06:29

this leads to weird :require and :import cases

dnolen23:06:13

@aengelberg: internally type hints are used for optimization quite a bit, externally only ^boolean should be considered anything remotely official