I want to create an observable from which to push values to my observers.
The problem is, that those values are obtained via calling a promise-returning method.
Is there a way to call await on the promise-returning function within the observable, like the following pseudo-code (which does not work, because i can't mark the function passed to the observable async)...
return new Observable((observer) => {
let counter = 0;
for(...)
{
try
{
const value = await promisefunction(counter++);
^^^^^
observer.next(value);
}
catch(error)
{
observer.complete();
}
}
});
await
can be used only withinasync
function – Julius