I noticed in the tut Clojurescript 101 that you can use closure classes like:
(ns async-tut1.core
(:import [goog.net XhrIo]))
But there is a note that says:
Note: import is only for this use case, you never use it with ClojureScript libraries
What does it really mean? As I understand it, you should not import classes this way. Am I correct? If I am, how would you do it then? Many thanks.
If you want to import the Closure classes, you use import, if you are importing functions or vars, then you use require or use:
(ns async-tut1.core
(:require [goog.events :refer [listen] :as ev])
(:import [goog.net XhrIo]))
What it means is that the import
form is specific to the use case of importing classes from the host libraries (google closure modules).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With