This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-24
Channels
- # beginners (64)
- # calva (40)
- # cider (76)
- # clara (13)
- # clojure (72)
- # clojure-dev (34)
- # clojure-italy (4)
- # clojure-nl (14)
- # clojure-poland (1)
- # clojure-uk (30)
- # clojurescript (58)
- # clr (10)
- # core-async (101)
- # cursive (31)
- # datomic (9)
- # emacs (20)
- # fulcro (2)
- # jackdaw (1)
- # jobs (3)
- # juxt (3)
- # luminus (4)
- # lumo (15)
- # mount (4)
- # nrepl (29)
- # nyc (1)
- # off-topic (27)
- # qlkit (1)
- # quil (5)
- # re-frame (19)
- # reitit (8)
- # remote-jobs (4)
- # rewrite-clj (5)
- # shadow-cljs (45)
- # spacemacs (22)
- # sql (9)
- # uncomplicate (1)
- # xtdb (14)
Closure docs has this example: var vsm = new goog.dom.ViewportSizeMonitor();
I wanted to translate this to something like (def vsm (new (goog.dom.ViewportSizeMonitor)))
, but get the complaint that "goog.dom.ViewportSizeMonitor is not a constructor". What would be the proper interop for this?
Also, it's apparently "not a function". This is the definition though: goog.dom.ViewportSizeMonitor = function(opt_window) {…
. What is it if not a function?
Never mind, answered my own question:
Require [goog.dom.ViewportSizeMonitor]
, then:
(let [vsm (goog.dom.ViewportSizeMonitor.)]
(.listen goog.events vsm goog.events.EventType.RESIZE
#(js/alert (str "View size: " (.getSize vsm)))))
Hey guys, I'm having trouble finding the errors in my reagent code I'm new to clojure so I'm not sure if I'm doing something wrong when I run figwheel it doesn't show any errors I have in the terminal Sometimes they will show in the browser instance rendered at the bottom in a little cljs window and sometimes they won't show at all but I never see them in the actual terminal that I am running figwheel from
That's one f the reasons I use shadow-cljs: because the compilation is more reliable on Shadow...
@jayvmithani646 me too (using lein figwheel) but not very often. Remedy is to stop figwheel, do "lein clean" and "lein cljsbuild once", fix the problems it announces, repeat the clean & cljsbuild until the result is clean, and then try figwheel again.
@phill Hey, thanks for the guidance. I followed your instructions and found the bugs in my code. Now when I run lein figwheel I still get no error reporting though. Maybe I'm misunderstanding what I'm supposed to be seeing. Are my errors supposed to show up in the repl? (where it shows app:cljs.user=> ).
@jayvmithani646 hm, are they compile errors or runtime errors?
ok, I'd expect either type of error to appear in the HUD on the page. but you can see compile errors in repl if you initiate a build there, e.g. => (build-once :dev)
I wouldn't expect errors on the page to appear in the repl -- they share the runtime but control isn't in the repl
if you're working on chrome I can recommend https://github.com/binaryage/dirac for a nicer cljs console experience
@idiomancy I played with webcomponents a couple years ago, maybe this helps a bit? https://gist.github.com/thheller/36332574918b974a3e4996efcb7457d2
ahhh, outstanding. that gist is right at the current level of progress I'm working through
@thheller can you shed a little light on these arguments? whats the idea behind recursively passing the function into the HTMLElement constructor?
(js/Reflect.construct js/HTMLElement #js [] component)
so, I mean, if you happen to remember, that's awesome, but if not I'll figure it out
@idiomancy not sure how current that is but back then it wasn't possible to construct a HTMLElement
subclass without actually using class
without Reflect
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/construct
Just curious, does swandonette hang in here anymore?
err, huh. okay so its... subclassing in that its using the function from A to build a new instance of C, where A and C are positionally the arguments to construct
is he still developing on Clojurescript? Also just being nosy
@idiomancy the component
argument in the Reflect.construct
call specifies the prototype
for normal ES6 classes you can do this https://gist.github.com/thheller/7f530b34de1c44589f4e0671e1ef7533
but that doesn't work for HTMLElement
because its a native class. maybe it works nowadays. didn't test this for a while
interesting. for me Reflect.construct doesn't work for HTMLElement
(js/Reflect.construct js/HTMLElement #js [] )
=> TypeError: Illegal constructor
the docs I'm looking at say that that's optional. says it will construct a new instance of the first arg unless the third is present
huh, gotcha. I'm hoping to discover some intuitive reasoning behind the choices made in there, but ¯\(ツ)/¯
the constructor is a function that calls js/Reflect.construct
, and that's the whole point
I don't really remember all the details but thats what it took to get a "web component" working back then