Fork me on GitHub
#clojurescript
<
2017-10-23
>
ag00:10:41

Can someone teach me how to use cljs.analyzer.api, when I do this:

(require '[cljs.analyzer.api])
(cljs.analyzer.api/all-ns)
I'm getting Error: No protocol method IDeref.-deref defined for type null what am I doing wrong?

dnolen00:10:39

@ag I’m assuming you’re trying to do that from Clojure?

ag00:10:22

I am trying both. Can't get my head around it ;(

mfikes01:10:31

@ag I think you need to ensure that the compiler environment is set up. This works:

(cljs.analyzer.api/with-state (cljs.analyzer.api/empty-state) [(cljs.analyzer.api/all-ns)])
(I find it odd that the body argument of with-state needs to be a sequence; perhaps the signature of with-state is missing an &.)

ag01:10:17

I'm trying this in cljs.repl - it doesn't seem to be working

mfikes14:10:46

@ag It is a Clojure API, as David alluded to.

mfikes14:10:11

(The JVM-based ClojureScript compiler is written in Clojure.)

tobowers08:10:28

I’m having a fair amount of trouble using :npm-deps . From bad babel output on https://www.npmjs.com/package/u2f-api (making it unusable) to having to do a lein clean instead of page refreshes (or else I get a “Undefined nameToPath”). What’s the appropriate place to file bugs for that kind of thing?

tobowers08:10:44

also… are there any work arounds?

maximgb14:10:35

Hello, has any one used "mori" library in pure javascript projects? I've installed mori via npm install and it mostly works, but misses the mori.zipper function. I've looked into mori sources at github and it exports zipper(), so it should be there. I wander what I did incorrectly.

di15:10:15

@maximgb those changes (https://github.com/swannodette/mori/commit/df9a69655282d4fa1a0c6036d9ccb7b4efdf9ce0) were never released — the last release is 0.3.2 in january 2015, but they were added in april.

maximgb15:10:59

@di so build from source is my only option, isn't it? Why has @dnolen decided against 0.3.3 release? Is mori still an active project and supported?

nha15:10:19

I seem to recall mori was looking for a maintainer

dhruv119:10:47

asking here as well update: I’ve looked at the externs file and there is only one var and it’s called ReactDraggable. i’ve tried using that as well, and still get the same error.

dhruv120:10:49

hmm trying to use most of the packages from cljsjs and they don’t seem to work. using this https://github.com/cljsjs/packages/wiki/Using-Packages as the guide

jbrown20:10:20

@dhruv1 hey i'm pretty new to clojurescript aswell, but ill try to help. You may have to recompile your project after you add the packages from http://cljsjs.github.io/ .

dhruv120:10:04

@brown.joshua49 thank you. i’ve been restarting my repl for a while now

jbrown20:10:58

ya that tripped me up for awhile the other day, other thing i thought was a little weird was the namespaces you access the javascript through are not always what they say

jbrown20:10:19

like uppercase might mean lowercase and lowercase might mean uppercase

dhruv120:10:20

it’s a tad confusing.

jbrown20:10:46

ya ill give that package a try give me a minute

dhruv120:10:57

oh sweet, thanks!

dhruv120:10:30

i’ve been trying it with lowercase and uppercase. tried following this guide (for a different package) https://www.opensourcery.co.za/2017/02/12/using-semantic-ui-react-with-re-frame/

dhruv120:10:34

and i get the same error

jbrown20:10:57

hey so i haven't gotten it exactly working, but i think it's importing to my project. did you try js/ReactDrag as the ns

jbrown20:10:09

or js/ReactDrag.

dhruv121:10:05

js/ReactDraggable

dhruv121:10:10

js/Draggable

dhruv121:10:22

where did you get js/ReactDrag from, i haven’t tried that ?

dhruv121:10:23

@brown.joshua49 i can require it my ns no problem. it’s when i try to use it i get the error

mahinshaw21:10:21

@dhruv1 Did you try using import my.ns.Class and call it with (Class.)

dhruv121:10:19

no i haven’t. can try that now.

dhruv121:10:55

@mahinshaw how do imports work for javascript libraries? how can i import

mahinshaw21:10:21

That’s an example from om

dhruv121:10:52

hmm. usign this extern i tried (:import [react-draggable DraggableCore]) (:import [react-draggable Draggable]) get this error:

----  Could not Analyze    ----

  No such namespace: react-draggable.DraggableCore, could not locate react_draggable/DraggableCore.cljs, react_draggable/DraggableCore.cljc, or JavaScript source providing "react-draggable.DraggableCore" in file <cljs repl>

----  Analysis Error  ---- 

dhruv121:10:00

looks like a problem with my environment. trying the example from the https://github.com/cljsjs/packages/wiki/Using-Packages and usign their examples, i still get the same error i’ve been getting

dhruv121:10:08

#object[ReferenceError ReferenceError: showdown is not defined]
#object[ReferenceError ReferenceError: showdown is not defined]
cljs.user>  

dhruv121:10:42

thanks @mahinshaw and @brown.joshua49 i’ll try to clean up my env and have a look

jbrown21:10:59

@dhruv1 hey sorry i didn't realize there are two different react-drag/gable packages available. I still think your issue is with the dependencies if you are getting a reference error. Make sure you're including [cljsjs/react-draggable "3.0.3-0"]. Then to use the component you have to adapt the class

jbrown21:10:19

Then i think you can use it normally after that

jbrown21:10:44

On a side note http://cljsjs.github.io/ is out of date and doesn

jbrown21:10:01

doesnt have all the current packages available on ity

stephenmhopper22:10:13

Hi everbody! Regarding imports in CLJS, what are the general recommendations around using :as vs :refer in :require? I typically use :as as I find (some-ns/some-fn ... to be less ambiguous than (some-fn .... However, a co-worker mentioned that my CLJS code will be more easily optimized by the Google Closure compiler if I use :refer. Thoughts?

thheller22:10:24

@stephenmhopper :refer has absolutely no effect on the closure compiler

thheller22:10:23

I prefer :as as well, :refer rarely.

dhd22:10:13

@brown.joshua49 thanks. I'll give that a try in a bit