Returns an AsyncGenerator wrapper around Reactive.
This allows values to be iterated over using a for await loop,
like Chains.
// Reactive numerical value constnumber = Reactive.number(10);
constg = Reactive.toGenerator(number); forawait (constvofg) { console.log(v); // Prints out whenever the reactive value changes } // Execution doesn't continue until Reactive finishes
When/if source closes, an exception is thrown.
To catch this, wrap the calling for await in a try-catch block
Returns an AsyncGenerator wrapper around Reactive. This allows values to be iterated over using a
for await
loop, like Chains.When/if
source
closes, an exception is thrown. To catch this, wrap the callingfor await
in a try-catch blockUse something like
setTimeout
to loop over the generator without impeding the rest of your code flow. For example: