Skip to content

Latest commit

 

History

History
83 lines (48 loc) · 2.73 KB

api.md

File metadata and controls

83 lines (48 loc) · 2.73 KB

API

In addition to clojure.core, clojure.set, clojure.edn, clojure.string, clojure.walk, clojure.data, clojure.test and clojure.pprint, nbb exposes the following namespaces:

Nbb

nbb.core

  • *file*: dynamic var representing the currently executing file.
  • (load-file f): reads contents of file f and then handles it using load-string.
  • (load-string s): asynchronously parses and evaluates s, returns result as promise.
  • (slurp f): asynchronously slurps contents of file to string, returns result as promise.
  • (time body): Macro which times async code.

nbb.repl

  • (repl), (repl opts): starts REPL which reads from stdin and prints to stdout. Returns promise which is resolved when input is closed.
  • (socket-repl), (socket-repl opts): starts REPL which reads from socket and writes to socket. Accepts optional opts map with :port. Returns promise which is resolved when input is closed.

nbb.error

  • (print-error-report e): print error report. Example: (try (assoc :foo :bar) (catch ^:sci/error js/Error e (nbb.error/print-error-report e)))

babashka.cli

See the babashka.cli API.

Promesa

See promesa docs.

promesa.core

  • *loop-run-fn*, ->, ->>, TimeoutException, all, any, as->, bind, cancel!, cancelled?, catch, catch', chain, chain', create, deferred, deferred?, delay, do, do!, done?, err, error, finally, future, handle, let, loop, map, mapcat, pending?, plet, promise, promise?, promisify, race, recur, reject!, rejected, rejected?, resolve!, resolved, resolved?, run!, then, then', thenable?, timeout, with-redefs, wrap

Reagent

See reagent docs.

reagent.core

  • atom, as-element, with-let, cursor, create-class, create-compiler

reagent.ratom

  • with-let-values, reactive?

reagent.dom.server

  • render-to-string, render-to-static-markup

Js-interop

See js-interop docs.

applied-science.js-interop

  • get, get-in, contains?, select-keys, lookup, assoc!, assoc-in!, update!, extend!, push!, unshift!, call, apply, call-in, apply-in, obj, let, fn, defn, lit

Tools.cli

clojure.tools.cli

  • format-lines, summarize, get-default-options, parse-opts, make-summary-part

transit-cljs

cognitect.transit

  • write, writer, write-handler, write-meta, read, read, read-handler, tagged-value

cljs-bean

cljs-bean.core

  • bean, bean?, object, ->js, ->clj