Fork me on GitHub
#clojurescript
<
2015-09-05
>
zentrope00:09:58

Is the goog.string.format pattern documented anywhere? I'd like to use "comma" separators in a number, but suspect that's not supported.

dnolen00:09:50

@zentrope: probably in the goog.string.format file

zentrope00:09:44

var formatRe = /%([0\-\ \+]*)(\d+)?(\.(\d+))?([%sfdiu])/g;

timgilbert00:09:09

I added a little section to the cljsjs wiki about the js interop stuff we were discussing, thanks for the help everybody. https://github.com/cljsjs/packages/wiki/Using-Packages

timgilbert00:09:55

Please let me know if anyone notices anything egregiously wrong

tel02:09:29

is there a shallow clj->js/js->cljs pair?

tel02:09:55

not a reader, a function

zane03:09:31

What's the etiquette for adding things to cljsjs that haven't had a formal release yet?

xifi06:09:31

dnolen suggested to give chrome canary a try but I don't see a linux version 😞

thomasdeutsch06:09:05

having trouble with js-interop - i want to translate this to cljs: textGroup.add(game.make.text("test") but i only know how to access properties like (.. js/obj -prop1 -prop2), how can i tell that prop2 is a function?

thomasdeutsch06:09:56

the question is, how can i write this in cljs: game.make.text("text") ?

jaen07:09:38

@thomasdeutsch: I think you just need to drop the leading dash

jaen07:09:36

@xifi: you don't really need Canary. I have beta channel (45.0.2454.78 right now) and it's new enough for what you want.

thomasdeutsch07:09:00

thank you @jaen `(.. game -make text)' will call the function, but how can pass the arguments?

jaen07:09:28

Maybe just tack them on to the form after the function? Let's see if I have a function I can check it on around

jaen07:09:44

Hm... doesn't

thomasdeutsch07:09:52

(.. game -make text "text") will resul... yes

jaen07:09:35

I suppose you'll have to resort to ((.. js/window -client -async -test_fn) "hurr" "durr") then

jaen07:09:46

That is using the function as property and then putting it in the funcall position

jaen07:09:57

Unless someone else has a brighter idea

xifi08:09:54

@jaen: thanks will give it a spin then

thomasdeutsch08:09:43

((.. game -add -text) "mytext" ) <- when i do this, the crazy thing seems to be that the local scope of the text function will be set to the window object, and not the "game" object. damn. can anyone help?

xifi08:09:21

how can I listen on a textarea's text change?

thomasdeutsch09:09:06

the solution is to do this: (. (. game -add) (text 10 10 "test" style)) , so be warned - the ".." will set the local this of a -prototype function to the window object

thomasdeutsch09:09:31

@xifi: i think this is more of a js question. You can watch for the key-up event. if you are using reactjs, you can use the synthetic event "onChange"

martinklepsch09:09:11

@timgilbert nice work on that cljsjs wiki page! :thumbsup:

jetzajac13:09:26

Hello everyone. I can't find a way to resolve symbol in cljs. I see that vars are not supported there in some sense.. I have an ns-qualified symbol like #'my-fn and a function there (defn my-fn[] ...) . how to get the second given the first?

jaen13:09:31

AFAIK that's not possible with Clojurescript implemented as it is now.

dnolen14:09:28

@jetzajac: you can't get the first without the second. ClojureScript does not support unbound vars at this time.

dnolen14:09:30

@tel there are no shallow versions of those operations

wilkerlucio18:09:24

@thomasintveld: I believe you can write game.make.text("text") as (.. game -make (text "text"))

arohner19:09:37

I’m trying to get rollbar to work (JS error tracking: https://rollbar.com/). My app is currently throwing an exception, and in chrome I see "Uncaught #error {:message "No parameter found in params …”}, which is an error thrown by bidi. There’s no stacktrace though, so I’m not sure what is catching that exception. Is that chrome? Is there some CLJS error handler?

arohner19:09:07

to turn that into more actionable questions:

arohner19:09:18

1) any ideas why I don’t get a stacktrace there?

arohner19:09:05

2) does CLJS get in the way of window.onerror ?

bhauman20:09:10

@martinklepsch: really really grateful for cljsjs. What an amazing resource.

martinklepsch20:09:35

😊 happy to hear that @bhauman — credit should really be given to all it’s amazing contributors simple_smile

zentrope23:09:53

Following this: http://www.martinklepsch.org/posts/parameterizing-clojurescript-builds.html, but I get "Unable to resolve symbol: quote in this context,".

martinklepsch23:09:51

@zentrope: are you specifying the key in :closure-defines as a quoted symbol? In project.clj everything is quoted already

martinklepsch23:09:17

(see documentation on `:closure-defines in the ClojureScript wiki)

zentrope23:09:58

In cljsbuild: :closure-defines {license-ui.main/ws-url "localhost:3449/ws"}

zentrope23:09:55

cljs 1.7.122.

martinklepsch23:09:33

@zentrope: try with a string key as well.

zentrope23:09:28

Okay, that worked.

zentrope23:09:46

Well, I mean figwheel started up. The value didn't actually change. ;)

zentrope23:09:16

Oh, wait. I only added that to advanced comp.

martinklepsch23:09:42

when using string keys you need to munge the symbol a-b/c becomes a_b.c (hope thats correct 😊)

zentrope23:09:28

Heh. I tried that with the quoted bit. Let's see.

martinklepsch23:09:48

I don’t know how using symbol keys works properly with lein/figwheel so if you happen to figure it out documenting it in the wiki would be great! simple_smile

zentrope23:09:00

Your post implied that the :closure-defines would work even with optimizations set to :none, right?

martinklepsch23:09:40

that’s the only novel thing about goog-define really

zentrope23:09:09

Except it's not working for me. I'll remove figwheel from the equation and see if that works.

martinklepsch23:09:38

I’d suspect you have an error in how you translated your symbol to a string

martinklepsch23:09:45

what does the string look like?

zentrope23:09:03

WARNING: WARNING - unknown @define variable license_ui.main/ws-url

zentrope23:09:45

In my file called "license-ui.main" I have (goog-define ws-url "DEFAULT").

zentrope23:09:11

In project.clj, I have: :closure-defines {"license_ui.main/ws-url" "IT WORKED"}

martinklepsch23:09:13

as said above: a-b/c becomes a_b.c

martinklepsch23:09:34

so try ”license_ui.main.ws-url” simple_smile

zentrope23:09:41

Oh, the dot.

zentrope23:09:22

I only picked up on the obvious - -> _ thing. ;)

zentrope23:09:56

And, ws-url becomes ws_url.

zentrope23:09:08

All, right. There we go. Sheesh!

zentrope23:09:50

And works with figwheel.

zentrope23:09:14

Yeah, figwheel requires the string form. cljsbuild by itself is okay with the quoted form.

zentrope23:09:25

As in, cljsbuild doesn't break, but it doesn't seem to find namespace either. Oh, well. Good enough.