- Run
npm installto install Playwright.
The Calva VS Code extension is widely used for Clojure(Script) development.
- Calva's Jack-in command is useful for starting a development REPL.
- Once a REPL has been started, interactive development can be done through Code Evaluation.
The following macro is quite helpful for REPL development:
(defmacro defp
"Define var when promise is resolved"
[binding expr]
`(-> ~expr (.then (fn [val]
(def ~binding val)))))You can use it like this:
(require '["playwright$default" :as pw])
(defp browser (.launch pw/chromium #js {:headless false}))
(defp context (.newContext browser))
(defp page (.newPage context))
(.goto page "https://weather.gov")