This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-03
Channels
- # admin-announcements (2)
- # beginners (18)
- # boot (118)
- # cider (12)
- # cljs-dev (12)
- # cljsrn (24)
- # clojure (142)
- # clojure-art (4)
- # clojure-bangladesh (3)
- # clojure-ireland (1)
- # clojure-italy (7)
- # clojure-norway (4)
- # clojure-poland (207)
- # clojure-russia (101)
- # clojurescript (108)
- # clojurewerkz (2)
- # core-async (6)
- # css (8)
- # data-science (23)
- # datomic (31)
- # devcards (2)
- # emacs (8)
- # funcool (25)
- # hoplon (34)
- # immutant (78)
- # ldnclj (7)
- # lein-figwheel (4)
- # leiningen (6)
- # luminus (35)
- # off-topic (1)
- # om (119)
- # onyx (43)
- # parinfer (29)
- # proton (11)
- # re-frame (25)
- # remote-jobs (1)
- # slack-help (1)
- # spacemacs (3)
- # yada (10)
whenever i do eg lein cljsbuild once min
, i just see the output "Compiling ClojureScript..." and then the command exits and nothing gets compiled. this happens to me on every cljs project, it's never worked for me. has anyone else seen this behavior?
for embarrassing context, what i typically do is have a long-lived lein figwheel
session, then ctrl-c it and run lein cljsbuild once min
so i can get a minified js file to scp around (rudimentary i know, i'll have a better system in place for this toy project eventually)
the "then ctrl-c it" bit happens every few days when i have something stable+good i want to upload so my friends can see it
well look at that, killing those dirs seems to have worked. could have sworn it didn't last time. sorry to bug you, thx david
Has anyone had experience with SyntaxError: Unexpected token .
while developing cljs macros?
i can’t tell if i’m really tired or if this is weird, need sanity check:
(defn send!
([ev-id] (@ws-send! [ev-id]))
([ev-id ev-data] (@ws-send! [ev-id ev-data])))
is causing
ANALYSIS ERROR: Parameter declaration "send!" should be a vector at line 27 /Users/adamjetmalani/code/conch/src/conch/arbiter.cljs on file /Users/adamjetmalani/code/conch/src/conch/arbiter.cljs, line 27, column 1
@akjetma: Your defn
works for me. (And it looks correct.) Which version of ClojureScript are you using?
wasn’t sure if there was some rule about a multi-sig function having to call itself or something
@akjetma: I’ve also confirmed it works on 1.7.228. I have no other thoughts other than to clean build.
k, that’s weird, i just redefined it to not be a multi-signature function and still getting the same error. must be some pebkac somewhere
okay! still strange, but there was a function later in the file that was missing its params declaration. not sure why the error message has the wrong function name
@escherize: this is terrific thanks so much for making this
you're welcome @danlucraft
@slotkenov: it would be nice to see the code for set-up-csrf-token
, without it it's difficult to say why the get or dispatch are not being called
I can't see anything wrong, apart from a word of caution about using with-redefs
with async
, but let's discuss that after understanding why "the mock is not being called" what test runner are you using?
I'm asking because some runners don't wait properly for tests to finish when there are async tests... but doo should not have that problem
I am using with-redefs
in another test without async with success. So might be the combination of those that bring the trouble, like you said.
I would imagine http/get is crashing in the go block
Does with-redefs cross go block boundaries in cljs?
the thing with with-redefs
is that done
from async
is a continuation fn that will execute the rest of your test suite... and depending on the layout of your code it might execute it in the scope of the with-redefs
, so you might "see" the redefs in other tests
the dispatch is going to be called in a different stack frame, where with-redefs wasn’t applied
so its probably calling the non-redefed dispatch
i would say the fact that it mocked http/get successfully is probably an implementation detail, but i dont know enough about the cljs core.async spec :X
ohh, it didn’t. yeah, I don’t think that would be guaranteed?
(go (…)) should immediately return the channel and then execute (…) in some other frame
like a setTimeout(#(…), 0), thinking in js
and in that frame, with-redefs isn’t applying. you’d need some global with-redefs 😛
ah, that would mean you can’t mock something that’ being called from within a go block?
i don’t know, looking at the source of with-redefs it seem possible, but i dont see a public API
hmmm, I was trying to understand why it is working in some tests that I have... and it's because I'm doing the with-redefs inside of a go block, and then I even give the other go block (what would be your set-up-csrf-token
fn) the chance to execute with a (<! (async/timeout 50))
... dirty, but it works for me
just be careful to not call done
before the body of your with-redefs
has finished, so as to not "see" the redefs in the following tests...
Just put a flag in another channel there? And watch for it outside of the with-redefs
yeah, I'm doing something like that... I'm using an atom though, but it's the same effect
Hi, starting to really jive ClojureScript on NodeJS for use with AWS Lambda. However, I wanted to double check that the best effort to get a REPL for this env was still via inf-clojure on Emacs. It appears that Cider does not support ClojureScript on NodeJS yet?
FYI, I am referring to this: https://github.com/clojure/clojurescript/wiki/Emacs-&-Inferior-Clojure-Interaction-Mode
I want to use in my app both react-with-addons
and bootstrap-cljs
. But when in my code I call a bootstrap function, I get in the browser an error: ReactBootstrap is not defined
. It seems to me that the problem is that in order to use react-with-addons
I had to exclude the regular react package in my project.clj
: [org.omcljs/om "0.9.0" :exclusions [cljsjs/react]]
. Am I correct? Is there a way around it?
@ashercoren: You are correct, but that shouldn't be causing a problem. cljsjs/react-with-addons
and cljsjs/react
each provide React
, but neither provide ReactBootstrap
That should be coming from cljsjs/react-bootstrap
, which is dependency of bootstrap-cljs
It should be required by bootstrap-cljs.core
: https://github.com/luxbock/bootstrap-cljs/blob/a24f4dda1ce9d9a062d26879db2ed9ad70551cb9/src/bootstrap_cljs/core.cljc#L3
@peeja: In my project.clj
dependencies I have om
with the exclusion of react
, followed by react-with-addons
and then bootstrap-cljs
. In my cljs
namespace I require bootstrap-cljs.core
. When I remove react-with-addons
from the porject.clj
and remove the exclusion of react
, the bootstrap component works fine
@ashercoren: Are you seeing any other errors that could be stopping ReactBootstrap
from fully loading?
@peeja: There is another error, coming from react-bootsrap.inc.js
: Uncaught TypeError: Super expression must either be null or a function, not undefined
I don't know react-bootstrap
at all, so I have no idea what that would be off the top of my head, but I would guess that it's the problem
@peeja: Good catch. I found this in closed issue in react-bootstrap
: Following React-Bootstrap this will only support React > 0.14
. React-with-addons uses react v0.12
Is there a way to use a higher version of React when using react-with-addons
?
:thumbsup:
Thank you! works like a charm!
Is it possible for a macro to throw an error/warning that would show up, for instance, in the Figwheel notice at the bottom of the screen?
I tried using throw
, but it appeared to silently halt compilation (at least, if you're only looking at the browser)
I've resorted to having the macro insert a throw
into the CLJS so it shows up at runtime in the console, but I don't love it.
Hello everybody, a question, what if in doo
I want to setup my environment before the test namespace(s) are required in my runner? Is there a way?
I may be asking in the wrong neighborhood but--- if I'm trying to jack into a repl in cider, and I get a java.lang.ClassNotFoundException regarding piggieback, is that because piggieback needs to be included in my project in order to connect to a repl in that fashion?
hunch: piggieback needs to be in plugins, since it's necessary for working on the project but it's not code that my project is actually depending on
@richiardiandrea: care to explain further? set up what environment?
in a node repl, is there an equivalent to load-file
to load google closure style modules that I've written myself?
Anyone here worried about cljsjs introducing global variables — e.g., if 2 cljsjs packages both introduce conflicting X's into the js namespace as js/X? Curious what other alternatives people are using to incorporate npm modules into their clojurescript projects.
Hi, does anybody have a good tutorial on how to write a NPM module in ClojureScript?
@arnaudsj: another idea is to just export your module as an object
this is how atom-parinfer does it: https://github.com/oakmac/atom-parinfer/blob/master/src-cljs/atom_parinfer/core.cljs#L453-L460
(atom extensions are basically npm modules with some special rules)
@chrisoakman: I like this!
@bensu thanks for asking but I solved, I used build-time trickery in order to differenciate browser/node conf...at the beginning I was thinking of using the runner but of course by the time you are in the namespace all your tests are already required (and you cannot use require in the runner anyways)
Does anyone have any suggestions for an efficient sliding buffer in CLJS? I want to keep up to n maps around, and ideally without hitting pathological cases for the persistent data structures. subvec seems to suggest that it’s always very fast, but it seems like it should be slightly faster in some cases than others, notably when you can throw away an entire interior node?
That sounds like a good use case for core.async buffered channels tbqh