Fork me on GitHub
#clojurescript
<
2018-11-29
>
lilactown01:11:06

tap> is pretty neat!

lilactown01:11:57

I needed a way for components to yell if they didn't have the data they needed to render properly so we could tell what parts of our application are down - I'm trying tap> + new relic's reporting

Whiskas13:11:50

Someone has any idea about what i would need to do in order to make VSCode integration with Google Chrome debugger to work with clojurescript? Like, what would be necessary to do if i needed to do an extension to make it works, or where i can read more about this kind of stuff

Whiskas13:11:01

What i want to do is to sync the breakpoints i set on VSCode with the breakpoints that chrome haves

Whiskas13:11:21

because the integration is kinda already done, since i can step through the code when a breakpoint i set on chrome is triggered

Whiskas13:11:43

but there is no syncing between chrome’s and VSCode’s breakpoints

Whiskas13:11:45

And other curiosity i have,

Whiskas13:11:16

There is any work done regarding the code navigation in Clojure/ClojureScript? When for example, i want to jump to the definition of a function and i press F12 on top of the symbol

Whiskas13:11:55

I’m thinking about making these stuff if they don’t already exists

Whiskas13:11:14

because i’m very used to navigating through code by jumping to symbol definition

potetm13:11:13

@mateus.pimentel.w Have you tried cursive? It does this.

Whiskas13:11:18

I’m looking for an alternative on VSCode 😕

thheller13:11:13

are you using calva? or any other clojure plugin? I vaguely remember something supporting that

Whiskas13:11:05

I’m using Calva

Whiskas13:11:25

Maybe the thing is that i did not put +cider when creating my project

Whiskas13:11:34

i will see how to add the dependencies

abdullahibra14:11:57

is this the right translation to this js code?

dnolen14:11:48

@abdullahibra it looks ok, #js {:authorization ... :container ...} is a thing too

dnolen14:11:32

do you have externs for braintree? or something else handling that for you?

abdullahibra14:11:45

i have included dropin.min.js as {:file "resources/dropin.min.js" :provides ["braintree.dropin"]}

abdullahibra14:11:57

yeah i have them in project.clj in dev and prod env

abdullahibra14:11:14

then require braintree.dropin in the ns i use it

abdullahibra14:11:17

but i got error

abdullahibra14:11:21

@dnolen any suggestions ?

abdullahibra14:11:43

also i got the same with js/braintree too

dnolen14:11:53

js/braintree should work

dnolen14:11:19

look in the browser JS console to confirm that A) the library was loaded B) you can access braintree

abdullahibra14:11:20

should i include the js in the html page?

dnolen14:11:32

check the browser

dnolen14:11:40

if braintree isn't there then you haven't loaded it

dnolen14:11:42

and it can't work

dnolen14:11:53

and now you know where to look for the problem

abdullahibra14:11:57

i have restarted figwheel

abdullahibra14:11:32

it's not a constructor so i should not add new

ClashTheBunny14:11:51

Those are methods? Or properties?

ClashTheBunny14:11:26

Should methods should have the dash?

abdullahibra14:11:10

thanks @dnolen seems not loaded i have checked sources in browser

dnolen14:11:27

@abdullahibra so you're require is not working it seems

abdullahibra14:11:40

but {:file "resources/dropin.min.js" :provides ["braintree.dropin"]} is enough to make it loaded

dnolen14:11:59

sure, but that's not what you're observing

dnolen14:11:01

so something is wrong

abdullahibra14:11:54

i do this: (:require braintree.dropin)

abdullahibra14:11:38

will try [braintree.dropin]

thheller14:11:42

@abdullahibra what is the rest of the .. form? what is coming after -create? maybe you are just calling it wrong?

abdullahibra14:11:33

that's a basic call

abdullahibra14:11:48

to make sure it will work then will add the actual code

thheller14:11:28

yeah that is incorrect

abdullahibra14:11:40

is this referring to anything ?

thheller14:11:31

(js/braintree.dropin.create
  #js {:authorization ""
       :container "#dropin-container"}
  #())

thheller14:11:05

-create is accessing the propery. but you attempt to call the function.

thheller14:11:35

(-> js/braintree
    .-dropin
    (.create #js {:authorization ""
                  :container "#dropin-container"}
      #()))

thheller14:11:48

(.. js/braintree
    -dropin
    (create #js {:authorization ""
                  :container "#dropin-container"}
      #()))

thheller14:11:53

those are your options

thheller14:11:15

they all do the same thing. up to you which you prefer

abdullahibra14:11:30

that's great guys

abdullahibra14:11:37

everything works fine now

hoppy19:11:15

is there a good channel to talk about cljs self-hosting questions/issues?

hoppy19:11:15

in particular, I'm having hella fun trying to get one of my namespaces loaded into the self-hosted part

dnolen19:11:13

here is a good place, if it’s particularly tricky feel free to ask in #cljs-dev

hoppy19:11:12

this is on node. I'm trying to get a 'state' setup where I can run code in there that can invoke stuff in host's namespace. I'm getting confused in the process of figuring out how to get my namespace loaded into that state. I've done the 'load-analysis-cache!' bit, but that doesn't seem adequate to get my namespaces visible from inside that environment. So I'm missing something.

dnolen19:11:29

hrm I’m not really following - but there are definitely other people who have already gone down this road

hoppy19:11:50

yeah, sending me to read some of that is probably good advice. The non-code info is pretty spotty.

hoppy19:11:37

basically just trying setup whatever it would to take to go from (empty-state) -> (require <my namespace>) -> (eval state <some-code-using my-namespace>)

kwladyka21:11:52

How to use :closure-defines with deps.edn?

{:deps {org.clojure/clojure {:mvn/version "1.9.0"}
        org.clojure/clojurescript {:mvn/version "1.10.439"}
        reagent {:mvn/version "0.8.1" :exclusions [cljsjs/react cljsjs/react-dom]}
        form-validator {:local/root "../form-validator-cljs"}
        ;{github-kwladyka/form-validator {:git/url "" :sha ""}}
        org.clojure/test.check {:mvn/version "0.9.0"}}
 :paths ["src" "resources"]
 :closure-defines {"goog.ATOM" "reagent"} ;; <<<<<<<
 :aliases {:fig {:extra-deps
                 {com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
                  com.bhauman/figwheel-main {:mvn/version "0.1.9"}}
                 :extra-paths ["target" "test"]}
           :build {:main-opts ["-m" "figwheel.main" "-b" "dev" "-r"]}
           :min {:main-opts ["-m" "figwheel.main" "-O" "advanced" "-bo" "dev"]}
           :test {:main-opts ["-m" "figwheel.main" "-co" "test.cljs.edn" "-m" form-validator-demo.test-runner]}}}
:build {:main-opts ["-m" "figwheel.main" "-b" "dev" "-r" "-co" "{:closure-defines {my-lib.core/config 'different'}}}"]} - so needs to be something like that? What then with :test. I am using file here. Can I use both? What is the best way to use closure-defines with deps.edn?

dnolen21:11:56

@kwladyka you put that in your build config, not deps.edn

dnolen21:11:18

just make a build config edn file, don’t mash everything into your deps.edn 🙂

dnolen21:11:26

Figwheel can load them via -b

kwladyka21:11:57

But what if I want to use always the same definition of value for all builds (aliases)? Do I have to set it for each one separately?

kwladyka21:11:28

Hmm or maybe I can just set it in core.cljs as goog-define. Will be still best practice with deps.edn?

kwladyka21:11:02

Generally my purpose is to set project (dependency module) to use atom or reagent.core/atom

kwladyka21:11:55

--- core.cljs

(goog-define goog.ATOM "reagent")
(println "AAA" (pr-str js/goog.ATOM))
Hmm why goog.ATOM is nil?

thheller21:11:31

@kwladyka goog-define declares a new closure define. it does not set another one.

kwladyka21:11:02

What do you mean?

thheller21:11:36

you can also only declare them in the ns you are in so the goog. is invalid there

kwladyka21:11:25

oh so I can use goog.X only when declare it in compiler parameters

thheller21:11:04

(ns foo.bar) (goog-define ATOM "bar") is foo.bar/ATOM in :closure-defines

kwladyka21:11:41

ok so there is no other way to set for dependency module value. Only :closure-defines, doing this in core.cljs is too late

thheller21:11:12

:closure-defines are basically compile time constants. so yeah only via build config

kwladyka21:11:55

ok so back to my question https://clojurians.slack.com/archives/C03S1L9DN/p1543526392302500 - how can I set it for a whole project to not repeat it each time for each build (alias)?

mfikes21:11:17

You will need to use the Corfield comma when defining :main-opts values that have spaces in them.

kwladyka21:11:56

“Corfield comma” ?

mfikes21:11:12

:build {:main-opts ["-m" "figwheel.main" "-b" "dev" "-r" "-co" "{:closure-defines,{my-lib.core/config,'different'}}}"]}

mfikes21:11:35

Othewise "{:closure-defines {my-lib.core/config 'different'}}}" is pulled apart into 3 separate tokens

kwladyka21:11:42

but then I have to do it also for :min and :test ?

kwladyka21:11:32

and with :test I am using file for -co so I have to move it to the file. It start to be a mess.

kwladyka21:11:40

No more elegant way?

mfikes21:11:03

Sometimes you can factor out common compiler options into a reused set of compiler options placed in a file and then rely on the fact that when passing multiple compiler options, they get merged. But, unfortunately, it is a straight merge, there is no fancy merge-with logic to merge multiple :closure-defines values.

kwladyka21:11:57

How to merge multiple edn compiler options file? -co file1,file2 / -co file1 -co file2 or something like that?

mfikes21:11:34

Yeah, see the help for that option

mfikes21:11:06

Both of your examples should work

kwladyka21:11:33

Thank you all for help