Releases: binaryage/chromex
0.6.0
Newly using promise-chan for callbacks
WARNING: this is potentially a breaking change!
I decided to change semantics of returned core.async channels from async api calls. In versions prior 0.6.0 they returned normal core.async channel chan
and the channel was closed after receiving a result value. Newly since this version they return promise-chan
instead and the channel is not closed. Please read more about semantics of promise-chan
here.
Under normal circumstances you should not need to rewrite your existing code, promise-chan
is just more flexible and allows multiple consumers of a single API call. Let's see some examples:
(let [api-call-channel (chromex.ext.tabs/get tab-id)]
(go
(if-some [result (<! api-call-channel)]
(do-something-with result)
(report-tab-not-found))))
(let [api-call-channel (chromex.ext.tabs/get tab-id)]
(go
(if-some [result (<! api-call-channel)]
(do-something-with result)
(report-tab-not-found))))
(go
(if-some [result (<! api-call-channel)]
(do-something-else-with result)
(report-tab-not-found))))
Let's compare behaviour of those code snippets under old and new circumstances.
We have a call to a chrome async api. In the first code snippet there is only one consumer of the result channel. In the second snippet there are multiple consumers waiting for the same answer.
Please note that the first snippet works the same under old and new version of the library. But the second code snippet does not work as expected under old version of the library.
Prior version 0.6.0 with chan
:
api-call-channel
is achan
api-call-channel
receives callback value as result and then closes- that means that only one of the go blocks receives the
result
, the other one will receivenil
Since version 0.6.0 with promise-chan
:
api-call-channel
is apromise-chan
api-call-channel
receives callback value as result and then DOES NOT close- that means (thanks to promise-chan semantics) that both go blocks receive the
result
value
Also note that in case of an error the channel gets closed and both go blocks execute their else branch.
Reverting to the old behaviour
I believe code using multiple consumers wasn't easily possible before so there is a low risk of breakage. If someone used multiple consumers they had to create their own "shared" channel (e.g. using promise-chan
and manage it on their own).
If you need to revert to old behaviour. Please look at this commit. You can configure chromex to use your custom implementations of :callback-channel-factory
and :callback-fn-factory
. By swapping them for old implementation you can easily get back the old behaviour.
API update
Regenerated APIs to match Chromium @ 2896ec3.
Notable commits:
0e925e2 use promise-chan for replacing callbacks
f13669a introduce last-error-args state
All new changes: v0.5.16...v0.6.0
0.5.16
API update
Regenerated APIs to match Chromium @ 3380294.
Notable commits:
c636c52 make default marshalling functions propagate nils (close #10)
05d08d7 make sure all cljs namespace :require-macros correspondent clj namespace
All new changes: v0.5.15...v0.5.16
0.5.15
API update
Regenerated APIs to match Chromium @ 7a7c695.
Notable commits:
NONE
All new changes: v0.5.14...v0.5.15
0.5.14
API update
Regenerated APIs to match Chromium @ e6aa1d1.
Notable commits:
1eaf952 start using :checked-arrays :warn
All new changes: v0.5.13...v0.5.14
0.5.13
API update
Regenerated APIs to match Chromium @ ed08e77.
Notable commits:
59f68c1 respect configured root object in default-callback-fn-factory
All new changes: v0.5.12...v0.5.13
0.5.12
0.5.11
API update
Regenerated APIs to match Chromium @ 113567d.
Notable commits:
none
All new changes: v0.5.10...v0.5.11
0.5.10
API update
Regenerated APIs to match Chromium @ 607db0a.
Notable commits:
none
All new changes: v0.5.9...v0.5.10
0.5.9
API update
Regenerated APIs to match Chromium @ bb2ecc3.
Notable commits:
none
All new changes: v0.5.8...v0.5.9
0.5.8
API update
Regenerated APIs to match Chromium @ d932d66.
Notable commits:
none
All new changes: v0.5.7...v0.5.8