Fork me on GitHub
#clojurescript
<
2017-03-19
>
johanatan00:03:30

hi, does anyone know a graph library for CLJS? It doesn't appear at first glance that either loom or ubergraph support CLJS...

nikki02:03:02

following the book "learning clojurescript"

nikki02:03:25

i have org.clojure/clojurescript "1.8.51"]] in :dependencies in project.clj

nikki02:03:43

but am getting

user=> (require 'cljs.build.api)
nil
user=> (cljs.build.api/build "src" {:main 'piggieback-project.core :output-to "out/main.js" :verbose true})

CompilerException java.lang.RuntimeException: No such var: cljs.build.api/build, compiling:(/private/var/folders/7c/lk5290b554q0231v96w3fk9c0000gn/T/form-init5643262653961972147.clj:1:1)

nikki02:03:52

in a lein repl

noisesmith02:03:44

what does (dir cljs.build.api) print out?

nikki02:03:54

nice, i tried that before 😮

nikki02:03:09

user=> (clojure.repl/dir cljs.build.api)
cljs-dependents-for-macro-namespaces
cljs-ns-dependents
mark-cljs-ns-for-recompile!
parse-js-ns
src-file->goog-require
src-file->target-file
target-file-for-cljs-ns
nil

nikki02:03:43

acc to https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/build/api.clj those are like the 'utilities' but the actual public API isn't here :thinking_face:

noisesmith02:03:18

the only thing I can suggest is changing the org.clojure/clojurescript version to a recent release, running lein clean then trying again

noisesmith02:03:52

cljs has been moving pretty fast, I think the latest stable was one of the 1.9 releases

nikki02:03:56

ok lein clean may help

nikki02:03:02

i used some weird version in the book first

nikki02:03:26

nope :thinking_face:

noisesmith02:03:30

oh yeah, definitely run clean between changing dep versions - the cache can get into pathological states when versions change in my experience

nikki02:03:40

i may just try remaking a project from scratch...

nikki02:03:44

will do soon, gotta go

nikki02:03:48

thanks for the help tho @noisesmith !

noisesmith02:03:35

@nikki - the other simple thing is to look at lein cp, see where it is getting cljs.build.api from, and checking the source it is loading

noisesmith02:03:46

perhaps it is getting a version that doesn't define the functions you need?

noisesmith02:03:59

your editor should be able to open the jar file as if it were a directory

johanatan02:03:27

to answer my own question: loom has very recently had CLJS support added although ubergraph still lags behind. for my purposes, loom is good enough however.

sandbags08:03:39

Does anyone have an example of adding a custom Chrome devtools formatter for a 'new' type of object? I can't make head nor tail of the documentation, or see anything in the source that suggests how its done. I have an object that it would be very convenient not to see as "[object Object]".

sandbags09:03:17

that first link is exactly what i needed, thank you @thheller

octahedrion13:03:07

why does cljs take so long to compile ?

(b/compile nil '(+ 1 2))
takes 2s on my laptop

qqq14:03:10

is this with :optimizations :none ?

qqq14:03:16

it's recompiling + reloading my code faster than that

nooga14:03:39

I’m trying to use cljs-ajax like this: (GET url) to download a simple text file for further parsing on the client side, when I println the value returned from this, it shows the body of the response with CLJS-AJAX response: prepended

nooga14:03:55

how do I get the raw body of the response?

octahedrion15:03:16

@qqq yes nil options is implicitly :optimizations :none

andrea.crotti16:03:25

having some strange issues with figwheel

andrea.crotti16:03:53

I thought it was related to cider, but also doing lein figwheel does the same,

andrea.crotti16:03:07

it gets stuck here even if I open the browser and the console

Exit: Control+C or :cljs/quit
 Results: Stored in vars *1, *2, *3, *e holds last exception object
Prompt will show when Figwheel connects to your application

andrea.crotti16:03:26

previously on the same project it was working fine

gklijs17:03:04

@andrea.crotti did you try restarting the browser already, seemed to have helped for me when I had similar problems.

andrea.crotti17:03:32

ah right that worked thanks @gklijs

andrea.crotti17:03:43

didn't think that could have been the problem

gklijs18:03:16

I have some problems with ia fuctions used in clojurescript, I read here, https://numergent.com/2015-01/ClojureScript-vs-CoffeeScript-for-Processing-sketches.html:

The initial ClojureScript implementation used maps for everything, which was horribly slow - I got about 9fps for 100 circles. A quick profile showed that a lot of time was being spent on accessing the map elements, and changing it so that the circle information was passed as a datatype improved performance by 300%.
I asume that is stil the case. I also saw you can make types mutable, would that be a good idea? For example I now store some information in a map, which I update as I ‘predict’ the next step, I could also update the values in the type.

mobileink18:03:40

main usually refers to a method in a class, a fn in a file, or sth similar. with cljs compilation, it refers to a namespace. if you do not use :main, you must goog.require the ns. from which i infer that cljs namespaces get wrapped somehow, such that merely importing them with <script...> does by itself not entail execution of their content, in contrast to what happens with raw js. is that close?

mobileink19:03:56

also, does using :main have any implications for efficiency?

dnolen22:03:08

@octo221 because you’re analyzing the standard library every time

dnolen22:03:59

@gklijs you could do that but I wouldn’t recommend it as a first optimization

mattsfrey23:03:33

has anyone had issues with goog.net.jsloader being undefined when building with optimizations turned on?