This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # 100-days-of-code (6)
- # announcements (4)
- # atlanta-clojurians (1)
- # aws (1)
- # beginners (65)
- # boot (21)
- # cider (9)
- # cljsrn (3)
- # clojure (186)
- # clojure-android (4)
- # clojure-conj (1)
- # clojure-dev (12)
- # clojure-germany (3)
- # clojure-italy (8)
- # clojure-nl (1)
- # clojure-russia (32)
- # clojure-spec (19)
- # clojure-uk (41)
- # clojurescript (83)
- # core-async (5)
- # cursive (18)
- # datomic (15)
- # emacs (5)
- # events (4)
- # fulcro (7)
- # hyperfiddle (4)
- # leiningen (4)
- # liberator (1)
- # off-topic (65)
- # overtone (4)
- # pedestal (5)
- # perun (1)
- # planck (3)
- # re-frame (1)
- # reagent (3)
- # rum (5)
- # shadow-cljs (8)
- # spacemacs (19)
- # testing (3)
- # tools-deps (4)
- # yada (6)
@mel.collins that depends on the packaging mechanism you use in the existing web app
I've actually managed to get the thing imported in the site, but it needs to be accessed via
hello.hello_world.core.hithere(), whereas I'd prefer something just like
I guess my question is more about how to build an npm package targeted at the browser-side
you could try https://shadow-cljs.github.io/docs/UsersGuide.html#target-npm-module which works fine with webpack
How would I write
window.navigator.msSaveBlob(blob, filename+'.pdf') in cljs with js interop?
I am doing this and it seems to be working... what should I watch out for? https://github.com/polymeris/cljs-aws/blob/master/test/cljs_aws/dynamodb_test.cljs#L11
so it seems then that if I want to test any async function, I need to pass in any functions I would want to stub as arguments
I have a question regarding string escapes with backslashes, replace and a difference to CLJ:
I need two different calls in CLJ and CLJS to get the same result and would appreciate if someone could explain that to me.
Is there a supposed way to do this correctly?
(s/replace "1 abc" #"(\d)" "$1\\\\.") ;; CLJ (s/replace "1 abc" #"(\d)" "$1\\.") ;; CLJS ;; to get: "1\\. abc"
For the record: I can work around the differences between CLJ and CLJS by invoking
s/replace with a fn as last argument. There the escaping works as expected. Still, I find this subtle and surprising.
@lilactown For me I have used
for replacing a function that is being called amongst my async code for testing purposes. You just need to manage the lifecycle yourself (if it even matters for your particular tests).
@ska this is by design, clojure uses strings from host platform and regex behaviour is different between java and js
but now when I think about it, your case seems to be different, because the bug seems to be in escaping of strings, not regex stuff
I’m struggling to understand Clojure’s behavior in the
s/replace example. Reading the source…
Ahh, this appears to be explained in
Matcher.replaceAll JavaDoc where it describes the special handling of backslash characters.
ClojureScript could theoretically behave like Clojure, also introducing
re-quote-replacement, but this would either be deemed a breaking change or a bug in ClojureScript.
Yeah, Clojure is adopting Java’s behavior, which “interprets” backslash characters in the replacement string.
@coinedtalk next Clojure dialect will be branched from ClojureScript behaviour, I'd like to see ClojureScriptReason, which would compile down to Ocaml/Reason and have normally behaving backslashes 😉
I mean, you could write a different version of ClojureScript or Clojure/Java replace that works however you want, but a regex library is almost certainly not something many people want to write or maintain.
In Clojure/Java you could I believe use
re-quote-replacement on part of a replacement string only, and concatenate it with other strings, but I have no idea whether that makes it easier to be more similar between Clojure vs. ClojureScript. The function approach sounds like a more straightforward way to reach that goal.
If you delve further into regex capabilities of one or the other platforms, I will bet you $5 you will find other even more subtle differences.
@ska You might get closer to sanity by passing
as your replacement string. You’d define
(str "$1" (re-quote-replacement "\\."))
identityin ClojureScript. Not saying to actually do that, but it may aid in understanding.
do I need to set up my project.clj any special way to make sure it pulls in
project.clj don't know each other, unless you marry them via some other tool
if your project uses lein, then go with checkout dependencies, if it does not use anything, then start with deps.edn
it uses lein. I have a complex aggregation of project.clj witchcraft supporting my autoreloading figwheel setup
or alternatively, if you just need a quick dirty patch on your local machine only, then you can patch your forked lib and install it locally with same version as official release (so your code would pick it up instead)
err.. well, actually you're right I guess I wasn't considering the fact that even if I patch it locally, I can compile the JS and deploy it anywhere
sure, clone the repo, make your changes, look into their project files, force version, and then build+install it locally
or better bump version to your own and change your project to depend on your
specific custom version