This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-22
Channels
- # announcements (9)
- # asami (52)
- # aws (1)
- # babashka (7)
- # babashka-sci-dev (12)
- # beginners (72)
- # calva (24)
- # cider (9)
- # clj-kondo (76)
- # cljs-dev (15)
- # clojure (19)
- # clojure-australia (4)
- # clojure-europe (33)
- # clojure-france (9)
- # clojure-gamedev (17)
- # clojure-nl (6)
- # clojure-portugal (5)
- # clojure-uk (5)
- # clojurescript (61)
- # clojureverse-ops (4)
- # code-reviews (23)
- # conjure (1)
- # data-science (2)
- # datalevin (6)
- # datomic (49)
- # gratitude (1)
- # helix (24)
- # holy-lambda (14)
- # jobs (3)
- # lsp (92)
- # malli (7)
- # missionary (8)
- # pathom (12)
- # proletarian (3)
- # re-frame (4)
- # remote-jobs (1)
- # shadow-cljs (4)
- # spacemacs (3)
- # sql (9)
- # tools-build (90)
- # vim (1)
- # xtdb (11)
Yes, @raymcdermott is trying to use the defn-args spec
My clojurescript app gets stuck in an infinite loop in Chrome 95 or higher. 94 is fine, as are FF and Safari. Anybody else experiencing this? Any hints on how I can debug this? (probably not cljs related, but no idea where to start) Any pointers much appreciated!
If you do indeed have a proper infinite loop it should be relatively easy to debug it from there.
pausing doesn't work, it disables the button (after I click it), but doesn't manage to actually pause execution
Either as a deployed version of a repository with instructions on how to run it locally.
it was caused by an absolutely positioned element – layouting issue
will work around it 😅 thank you for the pointers
So the browser was stuck while trying to compute the layout? Definitely sounds like a browser bug. :)
@borkdude but it's a .cljc
file so why can't it be required directly? Or did I miss something?
or the answer might be that they have the same name, and the .cljc
file is semantically .clj
as always, you can put this on http://ask.clojure.org and I'll make a ticket out of it
the original https://clojure.atlassian.net/browse/CLJ-2021 is 5 years old
161 | (defn foo 123)
-------^------------------------------------------------------------------------
Syntax error macroexpanding cljs.core/defn.
Call to cljs.core/defn did not conform to spec.
-- Spec failed --------------------
(... 123)
^^^
should satisfy
vector?
would including the core specs in cljs at runtime increase the production bundle size at all?
yeah, that's the reason i asked - wasn't sure if the specs got required by cljs.core or something
I would really like to use Ethers.js to interact with the Ethereum network from ClojureScript. Could anyone make a solid ClojureScript wrapper for the library? I’m willing to commission it if you DM me. I never learned JavaScript, so I don’t feel comfortable attacking this on my own. I would love it if the JS knowledge could be abstracted away in the ClojureScript wrapper. https://docs.ethers.io/v5/
i’m not convinced there is a utility to a CLJS wrapper. The kind of things you would do would be
• Translate back and forth from #js {:arg val}
and {:arg val}
• Re-expose methods on objects as functions in namespaces
all so you can do (ethers-providers/web-3-provider js/ethereum)
instead of (ether.providers.Web3Provider. js/ethereum)
and (provider/get-signer provider)
instead of (.getSigner provider)
Got it… thanks for the feedback there. Clojure is the only programming language I've worked with so I just didn't know if a ClojureScript wrapper with new documentation would make it so I don't need to learn JavaScript to work with it in ClojureScript
to debug any difficulties in development you would likely need to understand the JS semantics
you can only get so far doing Clojure without understanding the basics of Java. with ClojureScript, arguably it's more important to understand the JS under the hood since I find it a bit leakier
I have also thought about interacting with the EVM (ethereum virtual machine) from Clojure. Perhaps a more interesting way to approach it—is by using the Ethereum LLL (Low-level Lisp-like Language), which would be similar to Clojure.
I thought LLL was being phased out? https://github.com/ethereum/solidity/issues/6201
Have you seen this https://github.com/hayeah/evm-clojure ?
@rob370 have you seen this? https://github.com/district0x/cljs-web3-next
Not sure how different Ether.js is from web3, but it does seem to be a recent take on interfacing with eth from cljs
Yeah I have, from what I had heard ether.js was just a more approachable base library than web3.js
when I try to send a file to server instead of file I am sending a string which is [object File]
what I am doing wrong here:
(defn get-file-input []
(-> (.getElementById js/document "infile")
.-files first))
(defn upload-file []
(http/post ""
{:form-params {:key1 [1 2 3]
:key2 "value2"
:file (get-file-input)}}))
(defn ui
[]
[:div {:style {:font-family "Tahoma, Verdana, Sans-serif"
:font-size "larger"
:text-align :center}}
[:h1 "Upload your file"]
[:input#infile {:type :file}]
[:button {:on-click #(upload-file)} "Upload"]])
What is http
?
Also, don't use .getElementById
. Instead, store the file in an atom in a :on-change
handler attached to the :input
and pass the value of that atom to upload-file
. Avoid global references.
I'm 90% sure that for file uploading you have to use multipart data. cljs-http
has an example right in its README.
I followed read-me of r0mank’s cljs-http library here -> https://github.com/r0man/cljs-http
Please don't @ people without real need. Mere mentioning should be done without @.
Yes, I understand that you followed the README of the library. But you didn't follow it exactly. The file uploading examples all use :multipart-params
whereas your code uses :form-params
.