Fork me on GitHub
#clojurescript
<
2015-10-14
>
blissdev03:10:34

has anyone used the xlink:href attribute with sablono? having issues with it working correctly

blissdev03:10:59

perhaps i should try om.dom

blissdev03:10:56

current strategy looks like

[:div {:class "menu"}
                 [:button
                  [:svg {:class "settings icon"}
                   [:use {"xlink:href" "#settings-icon"}]]]]

blissdev03:10:33

which isn’t working

blissdev03:10:13

oh, if you do xlinkHref its supported in React 0.14 but can use dangerouslySetInnerHTML for now

blissdev03:10:17

sorry, answered for myself

blissdev03:10:12

looks like om.next should have 0.14

reefersleep07:10:20

@bhauman: I only just noticed that you had replied re: ranges in Reagent now. Why is it that you propose that ranges probably shouldn't be controlled components? I mean, is there more to it than "it doesn't work properly currently"? simple_smile

dimovich08:10:51

@sander: seems the latest cljs.jar 1.7.145 solves this problem. simple_smile

rbrtzbl11:10:02

hi, is there a way to get all members and attributes of a js object?

dnolen11:10:48

@rbrtzbl: see the goog.object Closure namespace

asolovyov12:10:10

@dnolen: I have rather weird question, but I'm not sure where to dig... So I have this server-side rendered app in React, and when I have a dev build, everything works just fine. But when I build an advanced minified version, running it with node spits out 'React is not defined'. Any pointers maybe how can I find out what's the problem?

dnolen12:10:18

@asolovyov: there’s a known bug with :main + :advanced and :foreign-libs that was filed by @maria

dnolen12:10:49

if it’s not the same issue then likely something with :advanced and Node.js that hasn’t been encountered before

dnolen12:10:03

:advanced w/ Node.js isn’t something we actively recommend or support

asolovyov12:10:07

hm, let me look at that bug...

asolovyov12:10:22

should I use :simple for node?

asolovyov12:10:30

hah, simple also fails!

dnolen12:10:40

are you using :main?

dnolen12:10:46

then that’s the bug

dnolen13:10:22

just applied @maria’s patch

asolovyov13:10:04

@dnolen: that's not my bug!

asolovyov13:10:20

actually, React is included and it seems the problem is triggered somewhere inside of it

dnolen13:10:53

ah hmm then I don’t know without more information

dnolen13:10:15

minimal case, ticket etc.

asolovyov13:10:58

yeah, that's what hard, I'm not exactly sure how to get to that simple_smile

asolovyov13:10:39

@dnolen: what do you think, is running :none on nodejs in production somehow bad? simple_smile

dnolen13:10:17

I can’t think of anything bad about that

dnolen13:10:39

you might want to compile with :static-fns true if you care about perf

thheller13:10:42

you probably want :optimize-constants in a production build

asolovyov13:10:59

makes sense!

thheller13:10:10

@dnolen your last om commit contains a bug

thheller13:10:36

cond-> does not thread the test

dnolen13:10:43

@thheller: oops yeah thanks

thheller13:10:29

om.next looks awesome so far, requires quite a bit of re-thinking of how to do things but that is good

dnolen14:10:33

@thheller: thanks, I’m pretty excited about it simple_smile

bensu15:10:31

@steve: I tried your instructions and this is the output of my figwheel REPL: https://gist.github.com/bensu/a8901162387c3340fb8e

bensu15:10:59

it seems to work, can you see if you did anything differently?

bensu15:10:24

@steve please answer there and ping me when you are done

dnolen16:10:14

A patch from @tonsky that should tested by people who are interested in this fix http://dev.clojure.org/jira/browse/CLJS-1458

dnolen16:10:24

mostly concerned about unintended breakage in attempt to match Clojure

dnolen16:10:48

another one that will affect Node.js users that could use testing http://dev.clojure.org/jira/browse/CLJS-1466

Pablo Fernandez16:10:52

What’s the fastest way to have figwheel pic up a library I just installed instead the compiled one? It’s a library I’m modifying, so, the version number is not changing in each modification.

sander17:10:49

pupeno: if i'm not mistaken, it helps to add -SNAPSHOT to the version number

bensu17:10:01

@steve: no problem, glad it worked out

steve17:10:37

@bensu I'd been reading through some of the clojurescript code to see how the tests were setup there

steve17:10:10

and saw them setup and working as expected, so I was definitely scratching my head.

richiardiandrea17:10:54

@dnolen: I tried a simple

(in-ns 'my.namespace) (def a 3)
in http://clojurescript.net/

richiardiandrea17:10:10

and it fails with Error: Assert failed: (ana/ast? sym)

dnolen17:10:33

@richiardiandrea: that link has nothing to do with ClojureScript in any official way

richiardiandrea17:10:42

tracked it down to defmethod emit* :var-special

dnolen17:10:46

anything you see there doesn’t mean anything wrt. ClojureScript

richiardiandrea17:10:13

I just wanted to ask if it can be a problem worth reporting (sorry if not) 😄

dnolen17:10:26

there’s nothing to report

dnolen17:10:39

that link has nothing to do with ClojureScript beyond somebody (a nice person) put it on the internet

cddr17:10:27

Anyone using auth.0 from cljs? How do you inject the client id into the js that runs on the client? The client id is not secret, but is different for different environments (e.g. uat, stage, prod etc) but ideally we'd like an identical build in each environment. I'm thinking of just putting the client ids into a little S3 resource and looking them up when the app initializes. Does this seem sane?

richiardiandrea17:10:22

kk now I know, just wanted to be helpful in finding problems I noticed...I apologize about it

mfikes18:10:54

@richiardiandrea: if you happen to find problems like those in either Planck or Replete, I'd be happy to look into GitHub issues and see if they can be isolated as minimal repros against the upstream ClojureScript self-host implementation. For in-ns it turns out that bootstrapped REPLs implement that REPL special (not ClojureScript proper).

richiardiandrea18:10:57

yes I notices in the source of

kanaka/cljs-bootstrap
that he is not implementing everything

richiardiandrea18:10:23

can you achieve a fully in-browser repl in your opinion? I am trying to figure that out

richiardiandrea18:10:55

for example here env/compiler is missing completely and I guess it is necessary for both cljs analyzer and compiler

mfikes18:10:51

@richiardiandrea: That's what http://clojurescript.net is, unless you are additionally thinking of require and load-file REPL specials. ClojureScript's cljs.js support affords REPL implementors lots of flexibility, though.

richiardiandrea18:10:17

oh maybe I am missing a piece then

mfikes18:10:52

@richiardiandrea: interesting... http://clojurescript.net certainly analyzes and compiles using only the JavaScript engine in your browser. Turn off your network connection and see. :)

richiardiandrea18:10:04

yes I know, I am trying to create my own version based on that work 😄

mfikes18:10:20

@richiardiandrea: Cool! I've been down that path, using Joel's stuff, but targeting non-browser environments. :) Let me know if you have questions.

richiardiandrea18:10:09

well the in-ns stuff does not work and I am trying to understand why, basically it needs to avoind using the env/compiler stuff

richiardiandrea18:10:36

it is easy, it is just a map containing ::namespaces

richiardiandrea18:10:33

I see in planck is using

(defonce current-ns (atom 'cljs.user))

richiardiandrea18:10:07

but I don't want to spam the channel, maybe I will PM you 😄

mfikes18:10:10

@richiardiandrea: it is probably simply that in-ns is only doing half: Setting the ns but not creating it.

mfikes18:10:33

@richiardiandrea: yep. Probably better.

sjol22:10:39

is there a way to tell the closure compiler not to minify a function? I'm trying to use leaflet and setRadius worked in dev mode but not when I attempted to compile for production

sjol22:10:58

I had other use cases where I just used aget and applied the function, but this doesn't seem to work... So I'm wondering if there's a way to hint or ...?

bensu22:10:11

@sjol: leaflet has a externs in cljsjs right?

sjol22:10:25

yes, and I have it installed

sjol22:10:41

[cljsjs/leaflet "0.7.3-4"]

bensu22:10:45

good! then you can add setRadius there and nobody will face this problem again simple_smile

sjol22:10:06

just not sure where it is in my project?

bensu22:10:18

it's not. I'll walk you through the process

sjol22:10:26

yes please!

bensu22:10:07

first get a copy of cljsjs, git clone

bensu22:10:30

then, go to leaflet's externs file, under packages/leaflet/resources/cljsjs/common/leaflet.ext.js

bensu22:10:46

now, in your source code, identify what is the class of the object that has setRadius

sjol22:10:54

circleMarker

bensu22:10:43

ok, so we need to tell the compiler that circleMarker has the property setRadius set to a function.

sjol22:10:54

ok, the default is a function right now

bensu22:10:39

right, it is ok that it is a function, since classes end up being constructors to the externs.

sjol22:10:40

"CircleMarker": function () {},
  "circleMarker": function () {},
  "CircleMarker": {
    "setRadius": function () {}
  },
  "circleMarker": {              
    "setRadius": function () {}
  },

sjol22:10:48

does that seem right?

bensu22:10:27

No. That is saying circleMaker is an object that has the setRadius set to a function

bensu22:10:03

You want to say, circleMaker is a constructor, whose constructed instances will have a setRadius set to a function. see the difference?

bensu22:10:21

As you can see in the d3 externs, you need to add a leaflet.circleMaker.prototype = function() {} to tell it it's a constructor

bensu22:10:39

in d3 it's d3.geo.circle.prototype = function () {};

sjol22:10:34

not many constructors in that file

bensu22:10:52

which talks about the instances

bensu22:10:22

something like leaflet.circleMaker.prototype = { "setRadius": function() {} }

richiardiandrea22:10:02

this is very useful for me too thanks @bensu

bensu22:10:02

@sjol No, you are right, that probably means that no instantiated objects will have their properties available under :advanced.

bensu22:10:23

@richiardiandrea: yeah, I might write this up somewhere

bensu22:10:33

(not tonight simple_smile it's late)

sjol22:10:49

L.circleMarker.prototype = function () {};
L.circleMarker.prototype = {
    "setRadius": function () {},
    "addTo": function () {}
};

sjol22:10:37

@richiardiandrea: that would explain a lot of woes I had!

bensu22:10:54

ok, with that in you need to build the package so that your other project has access to it

sjol22:10:00

what next?

richiardiandrea22:10:03

in my jqconsole package I have done something different though

tavistock22:10:07

I want to write a function that steps through a function like chromes dev tool, where should I start?

richiardiandrea22:10:27

but I see the function when :advanced

bensu22:10:41

@sjol ok, with that in you need to build the package so that your other project has access to it

bensu22:10:47

do you have boot installed?

sjol22:10:03

er no only lein

bensu22:10:24

cljsjs uses boot

sjol22:10:54

downloaded and ran boot libs are retrieving

bensu22:10:10

good, so now you need to build and install the leaflet project

richiardiandrea23:10:17

boot package build-jar
simple_smile

richiardiandrea23:10:34

cd-ing to your sub-dir first

sjol23:10:15

you mean in the leaflet one or packages?

bensu23:10:41

cd leaflet but first remove your old package with rm -r ~/.m2/repositories/cljsjs/leaflet

bensu23:10:06

so that you can then check if it's there

sjol23:10:11

seems to be done

bensu23:10:12

and the new version is under .m2/repositories/cljsjs/leaflet

sjol23:10:15

OMG! Circles!!!

bensu23:10:35

I can't believe it worked on the first try

sjol23:10:40

but this is only for my machine... how do I push?

sjol23:10:50

well, good instructions!

bensu23:10:46

hahaha, no sir, I've dealt with enough tutorial related issues to know that instructions are not enough

bensu23:10:48

I'd first recommend you to add all the symbols related to circleMaker and the other classes you might use in the future. You understand the process now, but you'll probably forget in the future when you need rectMaker and need to do everything again.

sjol23:10:53

well this time it worked, I'll open a PR for my changes

sjol23:10:23

yeah.... and other small ones

bensu23:10:45

it is usually 10 minutes to go through the API of the class and copy paste the symbols

bensu23:10:54

and then PR

sjol23:10:05

I'll open the pr so I don't forget 😉

bensu23:10:05

in case, these instructions don't work and you are in a hurry, you can always try with (let [m (goog.object/get o "setRadius")] (m radius)) which should protect you from symbol munging

thosmos23:10:14

is this correct? #?(:cljs (satisfies? IWithMeta x) :clj (instance? clojure.lang.IMeta x)

sjol23:10:29

o being my object

bensu23:10:10

@thosmos: it looks fine, minus one closing parens simple_smile

bensu23:10:37

@sjol: glad to help.