Skip to content

Commit fdc4b64

Browse files
committed
Adds some sourcecode docu
1 parent 35e60bd commit fdc4b64

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
# core.async-helpers [![Clojars Project](https://img.shields.io/clojars/v/jtk-dvlp/core.async-helpers.svg)](https://clojars.org/jtk-dvlp/core.async-helpers) [![cljdoc badge](https://cljdoc.org/badge/jtk-dvlp/core.async-helpers)](https://cljdoc.org/d/jtk-dvlp/core.async-helpers/CURRENT)
1+
[![Clojars Project](https://img.shields.io/clojars/v/jtk-dvlp/core.async-helpers.svg)](https://clojars.org/jtk-dvlp/core.async-helpers)
2+
[![cljdoc badge](https://cljdoc.org/badge/jtk-dvlp/core.async-helpers)](https://cljdoc.org/d/jtk-dvlp/core.async-helpers/CURRENT)
3+
[![License](https://img.shields.io/badge/License-EPL%202.0-red.svg)](https://opensource.org/licenses/EPL-2.0)
4+
5+
# core.async-helpers
26

37
Helper pack for core.async

src/jtk_dvlp/async.cljc

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44

55
#?(:cljs
66
(:require-macros
7-
[jtk-dvlp.async :refer [go* <e! safe]]))
7+
[jtk-dvlp.async :refer [go* <e! <p!]]))
88

99
#?(:clj
1010
(:require
1111
[clojure.core.async :as async]
12-
[jtk-dvlp.async.interop.promise :as p])
12+
[jtk-dvlp.async.interop.promise]
1313

1414
:cljs
1515
(:require
1616
[clojure.core.async :as async]
17-
[jtk-dvlp.async.interop.promise :as p])))
17+
[jtk-dvlp.async.interop.promise])))
1818

1919

2020
#?(:clj
@@ -76,7 +76,12 @@
7676
chs))
7777

7878
(defn promise-chan
79-
"TODO"
79+
"Creates an promise like channel, see `core.async/promise-chan`.
80+
81+
Given function `f` can be used to fill the promise.
82+
`f` will be called with one arg functions `resolve` and `reject`
83+
to resolve or reject the created promise. Rejection value will
84+
will be used as `ex-info` `cause`."
8085
([]
8186
(async/promise-chan))
8287

@@ -95,12 +100,17 @@
95100
c)))
96101

97102
(defn ->promise-chan
103+
"Ensure given channel `c` to be a `promise-chan` via
104+
`pipe` it into a new `promise-chan`. See `core.async/promise-chan`
105+
for more infos."
98106
[c]
99107
(->> (async/promise-chan)
100108
(async/pipe c)))
101109

102110
#?(:clj
103111
(defmacro <p!
104-
"Like `<!` for a promise via `p->c`."
112+
"Like `<e!` for promise via `p->c` convertion.
113+
114+
Usage in combination with `go*`."
105115
[?exp]
106-
`(<e! (p/p->c ~?exp))))
116+
`(<e! (jtk-dvlp.async.interop.promise/p->c ~?exp))))

src/jtk_dvlp/async/interop/promise.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
(defn p->c
16-
"Creates a promise-channel and put the val of resolved promise `p`
16+
"Creates a `promise-chan` and put the val of resolved promise `p`
1717
or put an instance of `ExceptionInfo` if promise is rejected.
1818
Closes the channel after took val."
1919
[p]

0 commit comments

Comments
 (0)