diff --git a/CHANGELOG.md b/CHANGELOG.md index 564671a..651ee67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog # +## Version 7.0.443 + +Date: 2022-02-22 + +- Add better builtin clj-kondo config (thanks to @wilkerlucio) +- Make `promise?` to check for IPromise protocol instead of concrete + types. +- Add `promesa.exec/with-dispatch` macro. + + ## Version 7.0.437 Date: 2022-02-21 diff --git a/doc/user-guide.md b/doc/user-guide.md index be6862f..c00ef2a 100644 --- a/doc/user-guide.md +++ b/doc/user-guide.md @@ -9,13 +9,13 @@ A promise library for Clojure and ClojureScript. Leiningen: ```clojure -[funcool/promesa "7.0.437"] +[funcool/promesa "7.0.443"] ``` deps.edn: ```clojure -funcool/promesa {:mvn/version "7.0.437"} +funcool/promesa {:mvn/version "7.0.443"} ``` On the JVM platform _promesa_ is built on top of *completable futures* diff --git a/src/promesa/core.cljc b/src/promesa/core.cljc index eda4646..bae6da4 100644 --- a/src/promesa/core.cljc +++ b/src/promesa/core.cljc @@ -92,8 +92,7 @@ (defn promise? "Return true if `v` is a promise instance." [v] - #?(:clj (instance? CompletionStage v) - :cljs (instance? impl/*default-promise* v))) + (satisfies? pt/IPromise v)) (defn deferred? "Return true if `v` is a promise instance (alias to `promise?`." diff --git a/src/promesa/exec.cljc b/src/promesa/exec.cljc index b958a39..2256656 100644 --- a/src/promesa/exec.cljc +++ b/src/promesa/exec.cljc @@ -329,3 +329,11 @@ (->ScheduledTask #js {:done done :cancelled false :cancel-fn cancel}))))) + +(defmacro with-dispatch + "Helper marcro for dispatch execution of the body to an executor + service." + [executor & body] + `(submit! ~executor (^:once fn* [] ~@body))) + + diff --git a/tools.clj b/tools.clj index 88aa91f..c273a89 100644 --- a/tools.clj +++ b/tools.clj @@ -40,11 +40,11 @@ :pseudo-names true :verbose true}) -(defmethod task "build:tests" +(defmethod task "build" [args] (api/build (api/inputs "src" "test") build-options)) -(defmethod task "watch:tests" +(defmethod task "watch" [args] (println "Start watch loop...") (letfn [(run-tests []