This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-28
Channels
- # announcements (1)
- # beginners (183)
- # boot (2)
- # clara (4)
- # cljs-dev (20)
- # clojure (59)
- # clojure-dev (7)
- # clojure-nl (1)
- # clojure-serbia (1)
- # clojure-sg (1)
- # clojure-spec (4)
- # clojure-uk (15)
- # clojurescript (77)
- # clr (1)
- # data-science (9)
- # datomic (23)
- # docs (3)
- # duct (15)
- # emacs (8)
- # events (1)
- # fulcro (6)
- # instaparse (3)
- # juxt (1)
- # lumo (9)
- # off-topic (18)
- # perun (2)
- # portkey (13)
- # reagent (2)
- # reitit (11)
- # ring (10)
- # shadow-cljs (158)
- # tools-deps (34)
Why can’t a MetaFn be used inside a js-obj
? Seems like only js/Function
s are allowed in a js-obj
?
((I’m trying to use an alexanderjamesking/spy
spy inside a js-obj
)
Ideal code would be (js-obj "addListener" (spy/stub))
But because spy/stub
is a MetaFn, you can’t call addListener
on the js-obj
Interesting, I’ll take a look into this, maybe I’ll need a different solution than metadata for cljs then. Thanks for letting me know @U3JH0P5LJ
hi everyone. if anyone’s using lein + shadow-cljs
in their project, may I see the example of project.clj
and shadow-cljs.edn
please?
no matter what I do in config files, I get the following
Could not locate clojure/spec/alpha__init.class or clojure/spec/alpha.clj on classpath.
@bravilogy seems like, you’re requiring clojure.spec.alpha, but in cljs it’s cljs.spec.alpha
the differences in API described here https://cljs.github.io/api/ and a little bit here https://clojurescript.org/about/differences
@bravilogy clojure 1.9 is required. I suspect you have clojure 1.8?
oh I see. actually this is my project.clj
:source-paths ["src"]
:dependencies [[binaryage/devtools "0.9.7"]
[thheller/shadow-cljs "2.3.28"]]
I’m testing it out at the moment and would like to use it with an existing project, so I created the project files from scratchbut whenever I try to use add dependency
tool within spacemacs, it specifically requires project.clj
and the main reason why I decided to switch to shadow-cljs is that I want to use a react-dropzone
file uploader in my project 😄
at the moment, to use that component with with figwheel, I have to yarn add ..
, then I use webpack to copy the script from node_modules (along with a few other js libraries) and compile it in a single file that I include in my project as a separate <script>
P.S. should I be worried about these?
shadow-cljs - Using IP "192.168.10.1" from Interface "vboxnet0"
May 28, 2018 12:51:12 PM clojure.tools.logging$eval1037$fn__1040 invoke
INFO: Found multiple IPs, might be using the wrong one. Please report all interfaces should the chosen one be incorrect.
May 28, 2018 12:51:12 PM clojure.tools.logging$eval1037$fn__1040 invoke
INFO: Found IP:192.168.10.1 Interface:vboxnet0
May 28, 2018 12:51:12 PM clojure.tools.logging$eval1037$fn__1040 invoke
INFO: Found IP:192.168.1.64 Interface:en0
May 28, 2018 12:51:12 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.8.Final
May 28, 2018 12:51:12 PM org.xnio.nio.NioXnio <clinit>
is there a sample command line for cljs.main with: nodejs target, repl and file watch and compile-opts in a edn file having npm-deps?
i. e. is this supposed to work at all?
it seems like the watch is not working. it complains that target is nodejs, but no :main option specified. I have specified a :main option however
@thheller sorry to bother you again. I’ve just set it up on the actual project and I’m getting the following error in my browser:
browser.cljs:310 WebSocket connection to '' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
I have a feeling this is to do with
:http-host ""
:http-port 8700
in my config. basically I’ve got the server already running through vagrant and I was hoping that it would listen to changes to http-host
I am using clj->js to store my data. But I have to load this data. the keyword values transforms into strings. --Not keys, the values-- Is there easy way to transform these values into keywords ?
I have read something about this topic. But, it says, you can use Prismatic/Schema.
You could use https://github.com/cognitect/transit-cljs if you use serialization just to store it and read it later in cljs
is it standard that I can't require nodejs standard lib in ns require decl anymore?
(ns my.app (:require [http])) doesnt work
what is the correct way to do this nowadays?
@leongrapenthin it's recommended that you use strings to require node namespaces, like (:require ["http" :as http])
doesnt work nonetheless
@scknkkrer Didn’t get your question completely but you can use (js->clj payload :keywordize-keys true)
to convert keys into keywords
dont use clj->js
if you intend on doing js->clj
since that will loose vital info like sets, keywords, symbols
transit is not designed for persisting afaik
I thought that transit was used to handle compiler analysis caching, which is persisting eh?
the idea is the same: serializing clojure data, implementation details make transit faster in practice. not relevant adding the extra lib unless you are frequently using it though.
Am I right that read-string
is clojure reader, so using it should bring whole compiler to the bundle?
@troglotit no read-string
is using cljs.tools.reader
. so not the full compiler.