cljs.js/compile
function | removed v1.7.28 | added v1.7.10 | Edit |
(compile state source cb)
(compile state source name cb)
(compile state source name opts cb)
Source docstring:
Compile ClojureScript source into JavaScript. The parameters:
state (atom)
the compiler state
source (string)
the ClojureScript source
name (symbol)
optional, the name of the source
opts (map)
compilation options.
:load - library resolution function, see *load-fn*
:source-map - set to true to generate inline source map information
cb (function)
callback, will be invoked with a map. If successful the map will contain
a key :value with the compilation result (string). If unsuccessful the map
will contain a key :error with an ex-info instance describing the cause
of failure.
(defn compile
([state source cb]
(compile state source nil cb))
([state source name cb]
(compile state source name nil cb))
([state source name opts cb]
{:pre [(atom? state) (string? source)
(valid-name? name) (valid-opts? opts) (fn? cb)]}
(compile*
{:*compiler* state
:*data-readers* tags/*cljs-data-readers*
:*analyze-deps* (or (:analyze-deps opts) true)
:*load-macros* (or (:load-macros opts) true)
:*load-fn* (or (:load opts) *load-fn*)
:*eval-fn* (or (:eval opts) *eval-fn*)
:*sm-data* (when (:source-map opts) (sm-data))}
source name opts cb)))