This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-08
Channels
- # admin-announcements (3)
- # arachne (1)
- # aws (2)
- # beginners (10)
- # boot (287)
- # cider (5)
- # clara (2)
- # cljs-dev (150)
- # cljsjs (2)
- # clojure (99)
- # clojure-austin (1)
- # clojure-brasil (1)
- # clojure-dev (13)
- # clojure-greece (55)
- # clojure-japan (1)
- # clojure-nl (2)
- # clojure-russia (24)
- # clojure-spec (184)
- # clojure-taiwan (1)
- # clojure-uk (45)
- # clojurescript (55)
- # clojurex (1)
- # cursive (20)
- # datascript (16)
- # datomic (1)
- # devcards (4)
- # events (10)
- # figwheel (1)
- # funcool (7)
- # hoplon (48)
- # immutant (1)
- # jobs (6)
- # lambdaisland (2)
- # lein-figwheel (19)
- # mount (36)
- # off-topic (37)
- # om (16)
- # om-next (17)
- # onyx (29)
- # planck (53)
- # proton (1)
- # pure-frame (1)
- # re-frame (40)
- # reagent (44)
- # remote-jobs (1)
- # ring (2)
- # robots (2)
- # rum (5)
- # slack-help (4)
- # spacemacs (27)
- # specter (82)
- # test-check (18)
- # test200 (1)
- # untangled (17)
I was crashing into http://dev.clojure.org/jira/browse/CLJS-536 but per dnolen's note there, I learned about extend-type
and got the following snippet to get clj->js
to retain namespaces in keywords. Is this a reasonable way to do so?
(extend-type Keyword
IEncodeJS
(-clj->js
[kw]
(str (namespace kw) "/" (name kw))))
I guess I could alternatively have used (subs (str kw) 1)
?Ah. Understood @dnolen. I'm stuffing EAVT tuples into a "regular" database (RethinkDB) as JSON and was confused why my attributes were coming out naked and un-namespaced.
what's the proper way to specify an extern for (let [c (.-Constructor (js/require "module")), o (new c)])
?
then when you call (.someFn o)
, you need Constructor.prototype.someFn = function() {};
, right?
and yes, if you’ve defined Constructor, then you define the methods as you’ve described
Idea: Slackify http://clojuredocs.org, so any library can get its own version of clojuredocs with its functions & docstrings and where people can post examples and add "see also"s.
can't quite figure out how to extend this javascript class with IFn, tried a few things
@jasonjckn: have a look here: http://blog.klipse.tech/clojure/2016/04/07/ifn.html
@jasonjckn: i think you are almost there. it should be extend-type
instead of specify
.
When starting up a cljs repl, I'm getting goog is not defined
and clojure is not defined
.
The namespace has loaded up properly, (e.g. I can (js/console.log "HELLO")
in the cljs file and see it show up in my console), but the initial payload of the repl results in goog is not defined
.
@potetm: sounds you haven’t configured :asset-path
for whatever makes for your web server setup
looking at the Network panel of any browser devtools should show you that no sources could be loaded
So, I'm getting 200s for all of my js files. It's the repl eval that causes the error. (I actually have only 200s in my network panel.)
@rohit: i got it working but then the google closure compiler emitted warnings about invalid arity
@jasonjckn: could you share some code?
(defui Foo
static IFn
(-invoke ([this a b] :yay))
Object
(render [T]
(div (str "Foo props: " (prn-str (om/props T))))))
(js/console.log (Foo 3 4))
the code works as expected, but when i edit the source file and figwheel reloads it I get an errorFigwheel: Compile Warning - Wrong number of args (2) passed to admin.ui/Foo at line 23 /Users/jason/d/play/admin/src/client/admin/ui.cljs
anyone have success loading figwheel to an already loaded page? I’m running into ‘can’t document.write after the page is fully loaded' errors
@jasonjckn: i gotta call it a night. its kinda late here. will check it in the morning. sorry about that
Is there any chance that a repl working dir can get into a bad state and cause those goog is not defined
errors? cc: meowy
It appears that all that matters is what's run first. If the first run does not include :optimizations :none
, then it connects successfully and will connect successfully on subsequent runs, not matter what optimizations are later specified.
Oh I forgot, the whole thing is loaded in an iframe, so it has to reload all of the code.
So :optimizations :none
can only work if you've specified a :main
, because otherwise it expects you to load yourself goog/base.js
first.
But, unfortunately, the browser repl env only allows you to pass in :optimizations
and :output-dir
into the initial compile.
Ah lookie what I found: http://dev.clojure.org/jira/browse/CLJS-1502