This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-03
Channels
- # announcements (5)
- # babashka (7)
- # beginners (119)
- # biff (4)
- # cider (7)
- # clj-kondo (26)
- # cljfx (3)
- # cljs-dev (2)
- # clojure (28)
- # clojure-austin (18)
- # clojure-europe (9)
- # clojure-france (6)
- # clojure-norway (4)
- # clojure-uk (3)
- # clojurescript (6)
- # community-development (1)
- # core-async (4)
- # cursive (9)
- # data-science (12)
- # datomic (13)
- # duct (18)
- # emacs (15)
- # etaoin (5)
- # events (13)
- # honeysql (46)
- # hyperfiddle (9)
- # jackdaw (5)
- # jobs (13)
- # keechma (4)
- # lsp (37)
- # malli (32)
- # nbb (14)
- # off-topic (10)
- # other-languages (2)
- # polylith (4)
- # programming-beginners (3)
- # reagent (27)
- # reitit (1)
- # shadow-cljs (32)
- # sql (11)
- # tools-build (5)
- # tools-deps (3)
- # vim (14)
- # xtdb (11)
hi hi,
I am looking for a little help, I have a build with :target :node-library
and I want to use js/performance.now
which is a browser global, available with const { performance } = require('perf_hooks');
on node.
see this https://stackoverflow.com/questions/23003252/window-performance-now-equivalent-in-nodejs ...
Is there an easy way to get this work, I am hacking with someone elses code, so I am mostly in the dark with clojure tbh.
I tried (:require ["perf_hooks" :refer (performance)] )
but that was giving me "Use of undeclared Var performance/now"
I am stuck :|
@exrhizo with :refer
you'd do (.now performance)
, :refer
does not set up a namespace alias so performance/
doesn't work. you can do (:require ["perf_hooks$performance" :as perf])
and then (perf/now)
.
When I eval something in the REPL, I get an error that looks like this:
:repl/exception!
;
; Execution error (TypeError) at (<cljs repl>:1).
Cannot read properties of null (reading 'cljs$core$IFn$_invoke$arity$1')
I can't figure out what's going wrong using just this info, is there any way to get more detailed traces?(defn calls-nil [f] (f 1 2 3 4 5))
(calls-nil nil)
Eval in REPL using standard Calva shortcut gets me:
:repl/exception!
;
; Execution error (TypeError) at (<cljs repl>:1).
Cannot read properties of null (reading 'call')
well that is sort of an artifact of how the code is generated differently when eval'd in the REPL.
if, for example, I set the :init-fn to calls-nil
, I get proper traces in the browser console:
@thheller hmm, any other way of getting the sourcemapped trace from *e
, or is it only possible by js/console.log
ing it?
would have been cool to be able to see/click the sourcemapped error without needing to switch to the browser window
I'll give it a shot and report findings if I manage to do anything 😄 Thanks for shadow-cljs by the way, it's a great project