Access callback as an iterable:
callback
const fn = () => Math.random();for (const v of fromFunction(fn)) { // Generate infinite random numbers} Copy
const fn = () => Math.random();for (const v of fromFunction(fn)) { // Generate infinite random numbers}
Use fromFunctionAwaited to await callback.
Function that generates a value
Access
callback
as an iterable:Use fromFunctionAwaited to await
callback
.