Skip to main content

*load-fn*

valuev1.7

cljs.js/*load-fn*

Each runtime environment provides a different way to load a library. Whatever function *load-fn* is bound to will be passed two arguments - a map and a callback function: The map will have the following keys: :name - the name of the library (a symbol) :macros - modifier signaling a macros namespace load :path - munged relative library path (a string) It is up to the implementor to correctly resolve the corresponding .cljs, .cljc, or .js resource (the order must be respected). If :macros is true resolution should only consider .clj or .cljc resources (the order must be respected). Upon resolution the callback should be invoked with a map containing the following keys: :lang - the language, :clj or :js :source - the source of the library (a string) :file - optional, the file path, it will be added to AST's :file keyword (but not in :meta) :cache - optional, if a :clj namespace has been precompiled to :js, can give an analysis cache for faster loads. :source-map - optional, if a :clj namespace has been precompiled to :js, can give a V3 source map JSON If the resource could not be resolved, the callback should be invoked with nil.

No examples yet. Be the first to add one!