We already support using asynchronous and generator functions as inputs to a reactive expression but until now we did not handle them when you use them as an input to an operation that is performed on the data. This meant that .rx.pipe and .rx.map would simply return the coroutine or generator as the value instead of evaluating it lazily.
Here we add support for these by scheduling the task on the event loop and then triggering an event when the function evaluates. Internally this is achieved by creating a Trigger which is added as one of the dependencies of the reactive expression such as that any consumer of the expression (whether Panel, the display hook or anything else) is notified when the async function or generator yields a new value.
In testing this I also found an oversight which meant that if you used a bound function as the input to .rx.pipe it would not extract its dependencies.
We already support using asynchronous and generator functions as inputs to a reactive expression but until now we did not handle them when you use them as an input to an operation that is performed on the data. This meant that
.rx.pipe
and.rx.map
would simply return the coroutine or generator as the value instead of evaluating it lazily.Here we add support for these by scheduling the task on the event loop and then triggering an event when the function evaluates. Internally this is achieved by creating a
Trigger
which is added as one of the dependencies of the reactive expression such as that any consumer of the expression (whether Panel, the display hook or anything else) is notified when the async function or generator yields a new value.In testing this I also found an oversight which meant that if you used a bound function as the input to
.rx.pipe
it would not extract its dependencies.