arrterian / promesa

A promise library for Clojure(Script/Dart)

Home Page:https://cljdoc.org/d/funcool/promesa/CURRENT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

promesa

Clojars Project

A lightweight promise/future library for Clojure & ClojureScript built on top of native primitives (js/Promise on JS, and CompletableFuture on JVM).

This library exposes a bunch of usefull syntactic abstractions that will considerably simplify to work with promises (in a very similar way as you will do it in JS with async/await).

(ns some.namespace
  (:require [promesa.core :as p]))

(defn fetch-uuid-v1
  []
  (p/let [response (js/fetch "https://httpbin.org/uuid")]
    (.json response)))

(defn fetch-uuid-v2
  []
  (p/-> (js/fetch "https://httpbin.org/uuid") .json))

See the complete documentation for more detailed information.

Contributing

Testing

Run the Clojure (.clj) tests:

clojure -Mdev -m promesa.tests.main

Run the ClojureScript (.cljs) tests:

clj -Mdev tools.clj build
node out/tests.js

About

A promise library for Clojure(Script/Dart)

https://cljdoc.org/d/funcool/promesa/CURRENT

License:BSD 2-Clause "Simplified" License


Languages

Language:Clojure 99.6%Language:Shell 0.4%