js/ namespace

special namespacesince v0.0-927Edit

Use a JavaScript variable.

  • js/document - the global document object
  • js/console.log - the global console log function

Details:

Everything after the js/ namespace is passed through to the compiled JavaScript.


Examples:

The following examples are run from a browser REPL.

Get the JavaScript global document object:

js/document
;;=> #<[object HTMLDocument]>

Display an alert:

(js/alert "Hello World")
;; displays alert popup

Log to console:

(js/console.log "Hello World")
;; displays in developer console

Create a JavaScript date object:

(js/Date.)
;;=> #inst "2015-07-14T00:25:33.881-00:00"

See Also: