Fork me on GitHub
#clojurescript
<
2019-05-04
>
leonoel08:05:20

@mikerod @dnolen FYI: macroexpand-time eval was exactly what I needed for injure. You define a graph of cljs fragments in clojure, then the graph is evaled and resolved by a macro, emitting a consolidated cljs form. https://github.com/leonoel/injure/blob/master/src/injure/core.clj#L10

tokoma08:05:45

Is it possible to refer javascript source code in clojurescript project ? I am using Clojure-cli and I'd like to know how to write deps.edn.

tdantas13:05:43

how do I know if a clojar is clojurescriptable or not ? maybe I’m doing something wrong, but once I tried to use data.csv on clojurescript my figwheel didn’t work weel and stop to transpile my code

tdantas13:05:16

is it possible to use (https://github.com/clojure/data.csv) on clojurescript ?

thheller13:05:59

@oliv no it is not. The code would need to either contain .cljs or .cljc code. https://github.com/clojure/data.csv/tree/master/src/main/clojure/clojure/data

thheller13:05:21

but given that the code is pretty Java centric porting this would not be easy

tdantas13:05:33

yep ! I see

tdantas13:05:38

thanks guys !

tokoma01:05:58

I modified deps.edn like this:

{:deps {org.clojure/clojurescript {:mvn/version "1.10.520"}
        cljsjs/react-dom {:mvn/version "16.2.0-3"}
        }
 :libs [
        "./js-src/test.js"
        ]  
 }
And js is as follows:
console.log("hello !")

var add = function(x,y) {
    return x + y;        
}
But it doesn't work yet.

mfikes01:05:37

@tokoma1 :libs doesn't go into deps.edn; it is a ClojureScript compiler option.

tokoma05:05:06

I had a look at clojurescript source code. it worked as follows: - js/calculator_global.js

Calculator = {
    add: function (a, b) {
        return a + b;
    },
    subtract: function (a, b) {
        return a - b;
    }
}
- ./build.edn
{
 :foreign-libs [{:file "js/calculator_global.js"
                 :provides ["calculator"]
                 :global-exports {calculator Calculator}}                
                ]
 }
- run repl
$ clj -m cljs.main -v -co build.edn -r 
- calling js functions from cljs
cljs.user=> (ns foo.core (:require [calculator :as calc])) 

foo.core=> (calc/add 1 1)
Execution error (Error) at (<cljs repl>:1).
Cannot read property 'add' of undefined

foo.core=> (ns foo.core (:require [calculator :as calc])) 
[object Object]
foo.core=> (calc/add 1 1)
2
foo.core=> (calc/subtract 1 1)
0

tdantas18:05:32

@thheller clojure.string does not have cljs or cljc and works on clojurescript, right ? how it is possible ? maybe because is “core” ?

tdantas18:05:11

owww, lovely, was reading the clojure.string ! makes sense ! ( im in love with re-frame/reagent + clojurescript )

solf19:05:18

Is figwheel-main stable, or should I start a new project with figwheel?

solf19:05:34

Nevermind, on http://figwheel.org it directly shows figwheel-main so I guess that's the version I should use

tokoma01:05:58

I modified deps.edn like this:

{:deps {org.clojure/clojurescript {:mvn/version "1.10.520"}
        cljsjs/react-dom {:mvn/version "16.2.0-3"}
        }
 :libs [
        "./js-src/test.js"
        ]  
 }
And js is as follows:
console.log("hello !")

var add = function(x,y) {
    return x + y;        
}
But it doesn't work yet.