This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-05
Channels
- # announcements (10)
- # beginners (59)
- # calva (172)
- # cider (13)
- # clj-kondo (1)
- # cljdoc (10)
- # cljs-dev (4)
- # cljsrn (65)
- # clojure (144)
- # clojure-europe (2)
- # clojure-italy (26)
- # clojure-losangeles (1)
- # clojure-nl (14)
- # clojure-spec (26)
- # clojure-uk (91)
- # clojurescript (75)
- # core-async (53)
- # cursive (11)
- # datomic (16)
- # fulcro (42)
- # graalvm (29)
- # graphql (9)
- # kaocha (3)
- # leiningen (22)
- # off-topic (26)
- # qa (1)
- # re-frame (3)
- # reagent (7)
- # reitit (10)
- # rewrite-clj (56)
- # robots (1)
- # shadow-cljs (107)
- # spacemacs (10)
- # specter (5)
- # sql (15)
- # tools-deps (39)
- # vim (11)
Has anyone ever managed to set the current line / column / file path of an evaluation from within a ClojureScript REPL? Edit: Maybe self hosting will do the trick? Just worried that'll mean it's not really the same. I presume there's subtle differences between JVM and self host ClojureScript.
I'm building a simple web app. In order to call a web service, I'm trying to include cljs-http. I've added the appropriate :require and :require-macros (according to the cljs-http github page) for cljs-http and core.async to my .cljs file, and the reference to [cljs-http "0.1.46"] in my project.clj file, but figwheel still gives me a 'No such namespace: cljs-http.client, could not locate cljs_http/client.cljs, cljs_http/client.cljc, or JavaScript source providing "cljs-http.client"' error. Any idea what gives?
I feel like I'm missing something obvious. My Reagent component is showing up in the browser with an extra 0s
transition timing which breaks the transition. Any idea why?
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions
I've modified my ns declaration to be this:(ns http://cql-viewer.app (:require-macros [cljs.core.async.macros :refer [go]]) (:require [reagent.core :as r] [cljs.core.async :refer [<!]] [cljs-http :as http]) )
@thheller ah I see now, I was assuming that changes would animate when figwheel is reloaded, but that's not the case - thanks for the pointer
but figwheel still can't find cljs-http. Any idea why it can't find this namespace (or the recommended cljs-http/client that also doesn't seem to work)
Yeah. That was what I meant when I typed cljs-http/client. Fumbly fingers. In any case, the cljs is not finding this package either. Could there be something in my project setup that's causing cljs-http not to be found? (defproject cql-viewer "0.0.1" :description "A viewer for CQL interpreter output." :dependencies [[org.clojure/clojure "1.9.0"] [binaryage/devtools "0.9.4"] [org.clojure/clojurescript "1.10.238" :scope "provided"] [reagent "0.7.0"] [cljs-http "0.1.46"] ] :source-paths ["src/cljs"] :plugins [[lein-figwheel "0.5.16"] [lein-cljsbuild "1.1.7" :exclusions [[org.clojure/clojure]]]] :cljsbuild {:builds [{:id "dev" :source-paths ["src/cljs"] :figwheel {:on-jsload "cql-viewer.core/on-js-reload" :open-urls ["http://localhost:3449/index.html"]} :compiler {:main cql-viewer.core :asset-path "js/compiled/out" :output-to "resources/public/js/compiled/cql-viewer.js" :output-dir "resources/public/js/compiled/out" :source-map-timestamp true}}]} :figwheel {:css-dirs ["resources/public/css"]} :profiles {:dev {:dependencies [[binaryage/devtools "0.9.9"] [figwheel-sidecar "0.5.16"] [cider/piggieback "0.3.1"]] :source-paths ["dev"] :clean-targets ^{:protect false} ["resources/public/js/compiled"]}})
Yes. I've been getting this error since yesterday evening when I tried to add the web service. I've cut and pasted directly from the github page for my setup and I'm not even calling any code from the packages yet - it just can't find the package.
I tried adding http-ajax and got a similar error. I'm beginning to think I'm cursed by the gods of http.
maybe you are in a different directory or some process is still running in the background
Lein's sitting in the project directory. I've been thinking it might be something in my lein configuration. Any idea where that's stored?
Are the repo directories hardwired? Because I swear I've seen a config file holding them (but I might be thinking of my emacs config).
cljs-http
README has this:
(:require [cljs-http.client :as http]
Well that was aggravating. I had to shut down lein and restart it. Obvious and annoying in retrospect.
I think if you change deps lein figwheel doesn’t pick that up.
I had the same problem with lein test-refresh.
hey has anyone recently gotten a clojurescript expo project running ? i tried the lein new expo template but the sdk is too old, and i couldn't figure out which versions of what to upgrade to in order to get it all compatible again
if so' i'd be eternally grateful for your build config , save me hours...
hey @chrisjswanson just saw your message in expo - you should definitely join the #cljsrn channel too. We have expo + cljs running, but I'm just going home for the day now, you're right there's a lot of things to figure out in order to get everything up to date, We've ended up making some quite significant changes to the whole thing, hopefully will contribute back at some point, but in the mean time can answer Qs
You might wanna try shadow-cljs and expo, too, I think I'd be tempted by that if I was starting from scratch today
I have a map:{"C" {"name" "C", "type" "Library", "evaluated" false, "value" nil, "isConst" false, …} , "E" {"name" "E", "type" "Library", "evaluated" false, "value" nil, "isConst" false, …} , "D" {"name" "D", "type" "Library", "evaluated" false, "value" nil, "isConst" false, …} }
I'm storing it in an atom @processed-cql and trying to add it to a web page with the hiccup [:p (str @processed-cql)]. However, the hiccup prints [Object object]. How can I get the map to display
I'm assuming it has something to do with the JS toString() operator, but I am a newbie at Clojurescript.
The map was originally JSON coming as a string from a web server. I converted it to a JS map using JSON.parse and then converted it to a Clojurescript one using js->clj as shown in the js->clj documentation. I've logged and checked all of the intermediate data from the conversion and it looks good. The final map is a Clojurescript map.
I've done that. Here's my code that makes the map: (go (let [response (<! (http/get url {:with-credentials? false})) b (:body response) _ (js/console.log b) json (.parse js/JSON b) _ (js/console.log json) m (js->clj json) _ (js/console.log m) ] m))
So, what you're facing is just typical JavaScript. Objects in JavaScript can't be printed out natively. You need to serialize them to a string to do so. You can use stringify on JSON (.stringify js/JSON #js {:a 12})
if you want.
how do you put it into hiccup then?
go
loop is async, you can’t just return a value from it afaik
But, ClojureScript data-structures natively support being serialized as EDN. So converting to a clj data-structure also works. Which you can do with js->clj
@fadrian if you want to take return value out of go
“process” you have to use a callback
(take! chan callback-render-hiccup)
Gah... That was it. I just read the documentation a bit more closely. I'll do some quick brushing up on core.async and hopefully I can get around this issue.
If you see cljs.core.async.impl.channels/ManyToManyChannel
, then @roman01la is probably right about your issue
@fadrian One suggestion is to drop core.async if you are not dealing with complex async flows
it generates lots of code and also tricks you into thinking stuff is executed synchrounously
promises are generally enough
(-> (js/fetch url) (.then #(.json %)) (.then #(js->clj %)))
@danieleneal thanks ! I'll definitely join and catch up soon. have a good evening
Also, it was designed first for Clojure, where you can do a synchronous blocking take for that kind of single value use case. But in ClojureScript, you can't. So it make more sense if you're going to be producing a stream. Like say you were grabbing responses and wanted to process them as they are received.
Well, now we've got js/Atomics and js/SharedArrayBuffers, which brings genuine blocking to webworker contexts https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait
And if you're only passing around typed arrays, which may be the case for some high performance application, it's a pretty low-overhead thing. Unfortunately, structures not already backed by typed arrays will still need to be serialized between worker contexts.
The future is long though, and it's not hard to imagine a lot of things getting converted to being backed by typed arrays, so they can be freely shared between js/wasm isolates
Hum.. I'm too out of touch with JavaScript and browser contexts to keep track of all these changes 😋
I don't even know what worker contexts are, did JS in browser now has support for threads?
I'll try that, roman01la. It seems pretty simple. didibus - this is just a debugging jig for a thing I'm writing. It would probably never need high enough performance to stream anything, so his solution is better for my needs. What I am writing will need something like core.async in its implementation, but then I first have the fun of shoehorning clojurescript into a standard node.js server environment, with things like express and webpack and many clojurescript/tool interactions that will make my progress halting. So it goes in the modern world of programming.
@fadrian for nodejs you'd probably want to look at Macchiato
FYI there's Fibers module for node https://github.com/laverdet/node-fibers