Fork me on GitHub
#cljs-dev
<
2021-04-02
>
Karol Wójcik08:04:04

Regarding the release draft I got one question. Is it possibile to name Window dependency in require as well? For instance I would rather use Promise then js/Promise.

thheller08:04:54

window is the default global in the browser so goog$global.Promise will work

👍 3
dominicm15:04:22

That doesn't seem right

cljs.user=> (require '[goog$global.Promise])
Execution error (ExceptionInfo) at cljs.repl/ns->input (repl.cljc:203).
goog$global.Promise does not exist

thheller15:04:53

pretty sure that needs an :as to work

dominicm15:04:02

I think I'm having general problems

thheller16:04:21

don't know how its handled in CLJS directly. shadow-cljs also had a bug related to this when done in the REPL. works fine in regular code though, maybe the same situation for the normal CLJS REPL

dominicm15:04:22

That doesn't seem right

cljs.user=> (require '[goog$global.Promise])
Execution error (ExceptionInfo) at cljs.repl/ns->input (repl.cljc:203).
goog$global.Promise does not exist

dominicm15:04:27

Actually, having problems getting this to work at all from a browser repl I spun up:

❯ clj -Sdeps ' {:deps {org.clojure/clojurescript {:mvn/version "1.10.844"}}} ' -m cljs.main -r
WARNING: When invoking clojure.main, use -M
ClojureScript 1.10.844
cljs.user=>  (require '[goog$global.Math :refer [max]])
Unexpected error (ExceptionInfo) compiling at (<cljs repl>:1:2).
Invalid :refer, var goog$global.Math/max does not exist at line 1 <cljs repl>