Repository navigation
Introduce Chrysalis protocol for async processing - #7
stevenproctor wants to merge 6 commits into
Conversation
|
I opened this regarding @cch1's comment about splitting out the Protocol for decoupling from core.async from the async presentation form |
|
Still in progress as I am adding tests. I am not sure Promises are working as desired. They may not be flattening as I was hoping they would. They also may not "present" correctly at the end since we catch and put the error in as the value, which kills the semantics of JavaScript Promises. |
|
The idea that we discussed where we don't need the presenter as the client could define the "root" level interceptor in the chain to be responsible for transforming from one type of async result to another async type doesn't work. It doesn't work because the outer wrapper is the first async type we come across, not the last. |
|
Still need to add/verify tests for when:
|
|
There looks to be some redundancy in the tests added around how futures and channels play together in the same interceptor chain. e.g., the presents-future-as-channel seems to be covered by the async versions of the future tests. This is partly because I have it so Not sure if it makes sense to keep the presents-as-channel to highlight where it might break if we change the It may also make sense to have the test be more fine-grained around e.g., JS/Promise contained a Channel which contained a JS/Promise, etc. Therefore the wrapped-handlers, that would be able to reach in and more deeply capture the result of the handler. I also added tests for mixing and matching channels and promises to ensure we are not getting nested async types and only flattening out of the same async type. |
Decouple dependence on core.async by introducing our own protocol to represent processing, while still allowing for core.async use if the client opts into using core.async by providing an optional namespace to include that allows a channel to implmement the Chrysalis protocol. Also update examples to include the optional namespace so they can still work with core.async.
- make promiser a `def`ed interceptor in cljs - some intermittent test failures, so highlighting when the returning channel from alts! is not the expected interceptor channel - add test for deeply mixing promises and channels
b98bb38 to
cad90b9
Compare
Decouple dependence on core.async by introducing our own protocol to represent processing, while still allowing for core.async use if the client opts into using core.async by providing an optional namespace to include that allows a channel to implmement the Chrysalis protocol.
Also update examples to include the optional namespace so they can still work with core.async.