Synchronous Programming with RxJS Observable | Task

Ole Ersoy
Feb - 04  -  1 min

Scenario

We want to synchronous access to the value streamed by our Observable.

Approach

Turn the Observable into a Promise and await it like this:

async function syncAccess() {
    const value:boolean = await of(true).toPromise();
    console.log(value)
}

Demo