This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-06
Channels
- # beginners (147)
- # boot (12)
- # chestnut (12)
- # cider (22)
- # clara (10)
- # cljs-dev (6)
- # cljs-experience (3)
- # cljsrn (12)
- # clojure (58)
- # clojure-austin (3)
- # clojure-dusseldorf (25)
- # clojure-finland (20)
- # clojure-gamedev (1)
- # clojure-greece (3)
- # clojure-italy (32)
- # clojure-new-zealand (5)
- # clojure-russia (12)
- # clojure-serbia (1)
- # clojure-spec (4)
- # clojure-uk (51)
- # clojurescript (75)
- # cursive (8)
- # datomic (81)
- # fulcro (29)
- # graphql (16)
- # heroku (6)
- # incanter (1)
- # keechma (1)
- # lumo (44)
- # off-topic (21)
- # onyx (22)
- # parinfer (5)
- # portkey (40)
- # re-frame (43)
- # reagent (5)
- # spacemacs (37)
- # specter (8)
- # unrepl (3)
unfortunately I can't even require it. All dependencies: react react-dom react-test renderer
are installed, importing enzyme
in node repl works. doing this:
(require 'cljs.repl)
(require 'cljs.repl.node)
(def repl-env (cljs.repl.node/repl-env))
(cljs.repl/repl repl-env)
;; and then
cljs.user=> (require '[enzyme :refer [shallow]])
does anybody know of a good payment gateway that can be integrated in my react-native app and also that works in India
@ag I guess your cljs build config should have :target :nodejs
@hparyani49 I've used both braintree and stripe in a cljsrn app, both worked fine. Not sure if they work in India
stripe is much better than braintree but customers in Europe often want Paypal
Ya they don't work here, anything else that you might be aware of?
@hparyani49 I'd check this list https://github.com/jondot/awesome-react-native#integrations
Thanks sir, I'll check and revert back
@hparyani49 there's also #cljsrn for all your react-native needs 🙂
I'll join that , thanks a lot:smile:
Hi all, There is something similar to https://github.com/babel/babel-standalone in clojurescript world?
@marciol ClojureScript optional bootstrapping can let you do that - but it does requires some effort
hmmm, good to know @dnolen. There is a repo called cljs-bootstrap
. Should I start with it?
When compiling a prd build of a clojurescript app, I'd like some warnings to cause the build to fail - things like :undeclared-var and :undeclared-ns - is that possible/are there any plans to make it possible?
@marciol it’s in ClojureScript proper
cljs.js
is the namespace
@tomc Available. See http://jakemccrary.com/blog/2015/12/19/clojurescript-treat-warnings-as-errors/
be aware that this is an advanced feature, so you’ll be on your own for the most part
Thanks @anmonteiro
Does anyone know how to wrap piggieback around clj.repl/repl
?
(require 'cljs.repl)
(require 'cljs.repl.node)
(def repl-env (cljs.repl.node/repl-env))
(cljs.repl/repl repl-env)
found the way:
(require 'cljs.repl)
(require 'cljs.repl.node)
(require 'cemerick.piggieback)
(def repl-env (cljs.repl.node/repl-env))
(cemerick.piggieback/cljs-repl repl-env)
Is there any way in ClojureScript to declare that a function must not be optimized away? I need to define something like (defn null-op [x] "")
so that it will remain a function call even under any future advanced compilation, rather than optimize down to ""
.
@deg you could try adding extern var null-op = function(){};
and export the function (defn ^:export null-op [x] "")
not sure if the export is needed, but extern is.
Is there a recipe somewhere for using cljs.pprint for print-fn (presuming console.log underneath)? I'm stumbling on it.
@cemerick I'm curious, how would that help?
AFAICT, it's the only way I'll be able to eliminate type tags from (some) printed records
@cemerick is your problem that cljs.pprint/pprint
takes a single argument?
@anmonteiro at the moment, my problem is that my set!'ing print-fn appears to have no effect at all! 😛
need more information
is that before or after enable-console-print!
?
and perhaps there’s another way
can you give me an example of something that prints tags that you don’t want to see?
@anmonteiro I'm doing all my fiddling after enable-console-print As an example, loom graphs are records that have a long-ish fqn for their type, which leads to pretty unpleasant wrapping for most outputs.
gotcha, so the #cljs.user.Foo
tags, for example
if there was a record Foo
1 sec
but actually, its print-fn routes through pprint, and so I have all the control I want when I'm there
Hmm… *print-fn*
and *print-err-fn*
are usually where things bottom out for env-centric stdout
and stderr
Yeah, I've been fiddling with it for 20 minutes and haven't gotten anywhere, so I figured I'd ask
The tags aren't suppressable at runtime (baked in by emit-record). I've not had to bother with this in CLJS because I've generally done all my dev work in Clojure, then just tested in CLJS. No longer. 🙂
maaan, I can't believe nobody has ever wrote a cljs wrapper for Enzyme (Airbnb testing lib - remember, the one they initially called Reagent and made a lot of our people angry. LOL). I'm trying to search on github and only biotech stuff popping up.... sigh
@cemerick so, this might not be what you want
but it works
(defrecord Foo [])
(extend-protocol IPrintWithWriter
Foo
(-pr-writer [o writer opts]
(-pr-writer (into {} o) writer opts)))
there are probably more clever solutions..
@anmonteiro I wonder if this isn't something anyone's necessarily tried to do, using pprint for *print-fn*
?
@anmonteiro confirmed win :thumbsup:
@cemerick so the problem with cljs.pprint
is that it calls out to *print-fn*
so you’ll end up making an infinite loop *print-fn*
-> cljs.pprint/pprint
-> *print-fn*
see: https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/pprint.cljs#L818
and the string-print
definition here: https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/core.cljs#L9581
@hlolli @deg extern is not the way to do that, that pattern is discouraged in Closure’s own docs
It is not clear to me what @deg really wants. :export
has clear semantics, but @deg's "not optimized away" could also be interpreted as prevent inlining.
@mfikes right but “preventing inlining” isn’t really a reasonable expectation when dealing with Closure Compiler IMO 🙂
Right. Perhaps a silly way to achieve that would be to make it’s body artificially large so the resulting code would be bigger if inlined. (Perhaps you’d also have to call it many times.) Hah
How safe is to set :static-fns and :fn-invoke-direct to true, with :optimizations = :simple ?
Pretty much the question is: Are there known set of flags which could be enabled for :optimizations = :simple and would give perfromance improvements “for free” (no potential runtime errors)?
@dragoncube :static-fns
, :optimize-constants
, :fn-invoke-direct
, :elide-asserts
@anmonteiro great, thanks!