How to use the lastValueFrom function from rxjs

Find comprehensive JavaScript rxjs.lastValueFrom code examples handpicked from public code repositorys.

63
64
65
66
67
68
69
70
71
72
 *
 * @returns A Promise that resolves if the success condition is met, or rejects otherwise.
 */
listen(commands) {
    const closeStreams = commands.map((command) => command.close);
    return Rx.lastValueFrom(Rx.merge(...closeStreams).pipe((0, operators_1.bufferCount)(closeStreams.length), (0, operators_1.switchMap)((exitInfos) => this.isSuccess(exitInfos)
        ? this.emitWithScheduler(Rx.of(exitInfos))
        : this.emitWithScheduler(Rx.throwError(exitInfos))), (0, operators_1.take)(1)));
}
emitWithScheduler(input) {
fork icon0
star icon0
watch icon1

+ 13 other calls in file

146
147
148
149
150
151
152
153
154
155
        ? value
        : this.pipesConsumer.apply(value, { metatype, type, data }, pipes);
}
async transformToResult(resultOrDeferred) {
    if (rxjs_1.isObservable(resultOrDeferred)) {
        return rxjs_1.lastValueFrom(resultOrDeferred);
    }
    return resultOrDeferred;
}
createGuardsFn(guards, instance, callback, contextType) {
fork icon0
star icon0
watch icon0

95
96
97
98
99
100
101
102
103
const activeEmployeesObservable = await fetchEachProfileActivityInParallel(
  page,
  profileLinks,
  waitUntilOptions
);
const activeEmployees = await rxjs.lastValueFrom(activeEmployeesObservable);

//Save profiles to a file
// saveProfiles(activeEmployees);
fork icon0
star icon0
watch icon0

94
95
96
97
98
99
100
101
102
103
if (!fs.existsSync(dir)) {
  fs.mkdirSync(dir, { recursive: true });
}
fs.writeFileSync(`${filepath}`, JSON.stringify([])); // CRIA O ARQUIVO VAZIO!
const downloadPath = `${downloadUrl}/core/${lang}/data/globals-${lang}.json`;
let globalsFile = await rxjs.lastValueFrom(
  new http.HttpService().get(downloadPath).pipe(
    // rxjs.tap((response) => {console.log(`Request GET: ${downloadPath}`)}),
    rxjs.map((response) => response.data),
  ),
fork icon0
star icon0
watch icon0