mirror of
https://github.com/vector-im/element-call.git
synced 2026-02-26 05:17:04 +00:00
prettier !
This commit is contained in:
@@ -5,14 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE in the repository root for full details.
|
||||
*/
|
||||
|
||||
import {
|
||||
catchError,
|
||||
from,
|
||||
map,
|
||||
type Observable,
|
||||
of,
|
||||
startWith
|
||||
} from "rxjs";
|
||||
import { catchError, from, map, type Observable, of, startWith } from "rxjs";
|
||||
|
||||
// TODO where are all the comments? ::cry::
|
||||
// There used to be an unitialized state!, a state might not start in loading
|
||||
@@ -34,13 +27,15 @@ export function async$<A>(promise: Promise<A>): Observable<Async<A>> {
|
||||
return from(promise).pipe(
|
||||
map(ready),
|
||||
startWith(loading),
|
||||
catchError((e: unknown) => of(error(e as Error ?? new Error("Unknown error")))),
|
||||
catchError((e: unknown) =>
|
||||
of(error((e as Error) ?? new Error("Unknown error"))),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function mapAsync<A, B>(
|
||||
async: Async<A>,
|
||||
project: (value: A) => B
|
||||
project: (value: A) => B,
|
||||
): Async<B> {
|
||||
return async.state === "ready" ? ready(project(async.value)) : async;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user