Skip to content

funcool/promesa

master
Switch branches/tags
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
dev
 
 
doc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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