This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-04
Channels
- # announcements (3)
- # babashka (14)
- # beginners (151)
- # calva (14)
- # cider (9)
- # clj-kondo (24)
- # cljdoc (12)
- # cljs-dev (195)
- # cljsjs (3)
- # cljsrn (13)
- # clojars (12)
- # clojure (234)
- # clojure-dev (3)
- # clojure-europe (9)
- # clojure-greece (1)
- # clojure-italy (2)
- # clojure-japan (4)
- # clojure-nl (4)
- # clojure-spec (89)
- # clojure-taiwan (1)
- # clojure-uk (16)
- # clojuredesign-podcast (2)
- # clojurescript (17)
- # conjure (11)
- # core-async (4)
- # core-typed (31)
- # cursive (9)
- # datomic (8)
- # emacs (17)
- # figwheel (1)
- # fulcro (5)
- # ghostwheel (42)
- # graphql (3)
- # hugsql (5)
- # jackdaw (3)
- # jobs-discuss (93)
- # joker (4)
- # meander (6)
- # mount (1)
- # off-topic (23)
- # pathom (10)
- # re-frame (23)
- # reitit (7)
- # remote-jobs (18)
- # shadow-cljs (153)
- # spacemacs (24)
- # sql (30)
- # tools-deps (14)
- # vim (12)
- # xtdb (1)
1. (resolve (symbol "max")) -> error: Argument to resolve must be a quoted symbol 2. (resolve 'max) -> working 3. (= 'max (symbol "max")) -> true 'max and (symbol "max") is same so #1 should work. but there is error. could u have any advice for me. or plz tell me any helpful link.
resolve is a macro in cljs, https://cljs.github.io/api/cljs.core/resolve
I think there are some work arounds by using cljs.analyzer.api/resolve
https://cljs.github.io/api/cljs.analyzer.api/resolve , but it can be tricky
I’m not sure you can use cljs.analyzer.api/resolve
in cljs, I think it has to be used in a clojure macro called from cljs
since the var information is only available at compile time
I compiled my cljs app into an npm module using shadow-cljs and want to call it within a JS module. This JS module has access to an object with global scope controlling URL state, and, given the architecture of the broader system, I have to use that object within my cljs code and access some methods within it. Think something to the effect of:
# my js file
mycljs.init(router) // within js module, initializing app with said needed object
...
# in my cljs file
(defn init [router]
... logic whatever ...
(.changePage router "someNewUrl"))
The problem is that this ... doesn't actually work. it complains there is no such function associated with the object (and, tellingly, the name is mangled in the console error logs--it complains there is no such function http://iq.Ga or some sort).
I have no issues accessing attributes, e.g.
(.-pathname router)
so I know I am at least converting the object properly. It's just the methods that are tripping it up.
So... my next thought is perhaps I need to define externs, because the cljs code is mangling the method names (I think)? I think I'm a bit uncertain because it seems like most of the things online I see about using JS modules are assuming you are running things via cljs and have access to the NPM module. I am sort of doing the reverse--compiling my cljs, calling that in regular js, and passing that function a js object. The cljs code does not know the NPM module exists at all, only that it's supposed to receive an object.@rbruehlman turn on externs inference. the compiler will tell you about things that are likely to be renamed and causing issues. https://shadow-cljs.github.io/docs/UsersGuide.html#externs
Hello clojurians, I encountered the same problem as in https://stackoverflow.com/questions/34700857/how-to-extend-protocols-to-clojurescript-collections-generically for the past with the latest release of clojurescript. Am I supposed to duplicate implementations or is there a better way to do this ? thank you
@pbaille you cannot do what you do in Clojure because JavaScript doesn't have interfaces
btw it's better to ask Clojure(Script) questions here: https://ask.clojure.org