This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-24
Channels
- # adventofcode (33)
- # beginners (15)
- # cider (6)
- # clara (24)
- # cljs-dev (3)
- # clojure (39)
- # clojure-france (1)
- # clojure-greece (1)
- # clojure-norway (1)
- # clojure-spec (9)
- # clojure-uk (1)
- # clojurescript (40)
- # defnpodcast (1)
- # fulcro (9)
- # hoplon (33)
- # jobs-discuss (4)
- # lumo (3)
- # off-topic (4)
- # onyx (2)
- # parinfer (7)
- # precept (45)
- # re-frame (25)
- # ring-swagger (4)
- # shadow-cljs (2)
- # specter (3)
- # sql (10)
- # uncomplicate (3)
- # unrepl (8)
(ns frontend-boilerplate.db
(:require [re-frame.core :as re-frame]
[goog.crypt :as crypt]))
(.log js/console crypt) ;undeclared variable
@melvoloskov That code also wouldn't work with clojure or requiring cljs namespaces. The crypt
is just an alias. If you refer to something within the namespace it'll be properly resolved
why [re-frame.core :as re-frame]
works and I just can use re-frame
, and then exactly the same [goog.crypt :as crypt]
doesn't?
Require is all good in your case. Nothing wrong with it. Just call a fn like crypt/utf8ByteArrayToString
@melvoloskov You'll get the same error when you use re-frame
by itself.
thank you! thanks a lot! that was the answer I was looking for all that time I spend trying to figure that out
Hi, I added the dependency [cljsjs/react-color "2.13.1-0"]
to the 'simple' re-frame example, and now it won't load. Using figwheel, getting console error: "Uncaught TypeError: getNextDebugID is not a function". When I remove it again, it loads normally.
@celwell Check lein deps :tree
and look which React version is getting used, should be 15.6 but old cljsjs lib might bring in 15.4
I just came to know there's no such <!!
in clojurescript
what's the alternative?
@qqq so how should I deal with channels outside a go
block?
put! and take! still work iirc
but usually the option is to use them inside a go block
oh thanks
one thing that can help is having take! with a callback that modifies an atom you use elsewhere (or altering that atom inside a go block)
mmh, well I use cljs-http to make some http request
I still have to figure out how to use the channel I get from the request
you can alter some data inside a go block, or you can put the rest of your code in go blocks after that point, or you can use take! and do your side effect in a callback
I'm using re-frame and I have the http request being done from the block of an event handler
event handlers should return the new state of the app
so I need to have the results available synchronously
then you shouldn't be using an async library?
can't you create a new event in the callback of a take! call?
that's a viable solution
but still I wonder if there's anything similar to await
/`async` in clojurescript
core.async is highly opinionated, and make a number of actions impossible that usually one would consider to be normal
it uses a formal model called CSP and adding certain operations to CSP breaks it
I'd assume it's possible to use await / async, I'm not sure what that looks like though
@erhardt.mundt You should look at re-frame/http-fx (https://github.com/Day8/re-frame-http-fx) to do http calls asynchronously
There's no need to wait for a response to an http request. You have one handler make the call, and then when the response comes in, you fire a new event to handle it.