This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # alda (1)
- # aws-lambda (1)
- # bangalore-clj (1)
- # beginners (70)
- # boot (24)
- # cider (1)
- # cljs-dev (167)
- # cljsjs (8)
- # cljsrn (17)
- # clojure (224)
- # clojure-android (7)
- # clojure-austin (8)
- # clojure-russia (17)
- # clojure-spec (120)
- # clojure-uk (46)
- # clojurescript (68)
- # community-development (198)
- # conf-proposals (1)
- # core-async (7)
- # cursive (6)
- # datomic (27)
- # dirac (19)
- # events (9)
- # hoplon (2)
- # jobs (1)
- # luminus (9)
- # off-topic (1)
- # om (281)
- # om-next (5)
- # onyx (50)
- # pedestal (1)
- # re-frame (19)
- # reagent (11)
- # ring-swagger (14)
- # slack-help (2)
- # spacemacs (1)
- # untangled (72)
- # yada (30)
I think it depends on the library. for core.async, the only thing that works for me is :require-macros
Implicit macro loading: If a namespace is required or used, and that namespace itself requires or uses macros from its own namespace, then the macros will be implicitly required or used using the same specifications. Furthermore, in this case, macro vars may be included in a :refer or :only spec. This oftentimes leads to simplified library usage, such that the consuming namespace need not be concerned about explicitly distinguishing between whether certain vars are functions or macros. For example: (ns testme.core (:require [cljs.test :as test :refer [test-var deftest]]))
if I read that right you cannot require / refer macros directly in a library implementation (need to use :require-macros), but if you do and the macros are in the same namespace as the lib, users of the lib can use :refer and :require for macros as well as functions.
I'm trying to convert ES6 style imports (`import foo from 'bar'`) to clojurescript and often discover that what I get when I call
require is an object with a key
default. What's that about?
Is there any Om Next alternative where I can use datomic pull syntax to describe frontend data query?
@plexus this is interesting but also surprising. Does this mean that I can
(require) js libs with today's cljs compiler?
this relates to using
:module-type, so letting Google Closure convert from ES2015 to its own goog.require stuff
yes, it works today, but for a lot of code "in the wild" don't expect it to be a great experience
been playing with it for a few days now, main takeaways: CommonJS and AMD modules are supported, but most schemes that libraries use to "detect" what module system they're in will cause it to fail, see http://dev.clojure.org/jira/browse/CLJS-1777?focusedCommentId=43857
I'm guessing most ES2015 modules don't do funky things like that so there it's probably less an option
the other thing is that for real world projects where code is split in many modules, and has dependencies on other projects, you need to add an entry to
:foreign-libs for each of those, and then hope that Closure figures out the imports correctly (and that the code doesn't violate the Closure assumptions to begin with, or you'll get stuff like "Warning: unsafe use of global 'this'")
:foreign-libs could be solved with tooling. GC will have to get better at consuming/converting funky UMD modules, so we can start testing it on real world libraries
and maybe then we find out that most of that code is inherently unsuitable for GC's analysis and processing...
well I don't sweat the foreign-libs issue as you can get around it:
(some-> (aget obj "method") (.call obj "param"))
(I also use
some-> in case the library is not available but that's obv not necessary)
I'm not sure we're talking about the same thing. The correct
:foreign-libs is necessary for a successful compilation. If you try to use
:module-type but GC can't correctly convert the module, either the build won't work, or you'll end up with a broken result. Not much you can do about that at runtime
I'm trying to add unit tests to a lein project, and I am finding stuff, but is there an official way?
(if (and (exists? js/module) (exists? js/module.exports)) (do node stuff) (do browser stuff))
@jiyinyiyong If you find yourself writing a lot of
(js* "...") blocks, consider just making a pure
.js module. You set it's namespace with
what's the way to use a Closure "namespace" from CLJS? i.e. a JS file with
goog.provide and all of that?
should it be in
:foreign-libs, or in the source directory together with cljs files? or ...?
(note this is not a file that's part of the Closure Library, just some other file that follows the Closure conventions)
@plexus when it's on the classpath it has to follow classpath conventions (e.g. dots indicate directories) — if things don't match in that way you can use
:libs (analogous to
If you look at the
deps.cljs of some of the Closure packages on https://cljsjs.github.io that might be interesting as well
@plexus yes if the Google Closure namespace is on the classpath and it’s namespace matches, it just works
it’s why we can just package that up in a JAR and use it transparently from ClojureScript
Hi, how do I use pipeline-async from core.async lib? should I read from channel returned by this function or from
to channel that I pass as arg ?
setting up token based auth for my clojure/clojurescript app. How do i set the request header to be the token on every subsequent request after signing in?
You’ll need to retain it in memory in the browser and include it whenever you make an AJAX request.
If you’re using XhrIo, the fifth argument to the
.send method is an object of headers.
im using cljs-ajax. and reagent re-frame for application. so i can store it in localstorage and whenever it is present in localstorage i send it with ajax request