skip to Main Content

Javascript – Angular rxjs takeUntilDestroyed

Just need some clarification on documentation of takeUntilDestroyed operator, so reading this doc: https://angular.io/api/core/rxjs-interop/takeUntilDestroyed , I dont see any words that I should use takeUntilDestroyed without params only in "injection" context (I dont really know what does this means). So…

VIEW QUESTION

Javascript – two `mergeMap` aren't lazy

import { of, mergeMap, concatAll, toArray, take } from 'rxjs' const duplicateValue = log => value => { console.log(log, value) return Promise.resolve([value, value]); } of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).pipe( mergeMap(duplicateValue('mapping a'), 1), concatAll(), mergeMap(duplicateValue('mapping b'),…

VIEW QUESTION

Javascript – How can I create a lazy RxJS observable that calculates value only on once, and only when first subscribed?

I have the following class: class BucketManager { private readonly bucketNames$ = new BehaviorSubject<string[] | null>(null) bucketNames = this.bucketNames$.asObservable().pipe(filter(bucketNames => !!bucketNames)) as Observable<string[]> constructor() { this.init() } async init() { const fetchedBuckets = await someExpensiveLongCalculation() this.bucketNames$.next(fetchedBuckets) } } Currently, the…

VIEW QUESTION

Javascript – how to solve misused promise function

found this piece of code which is actually working but eslint is complaining about the misused promise this.subject$.pipe(delay(this.debounceTime || 0)).subscribe(async ({ entry, observer }) => { const target = entry.target as HTMLElement; const isStillVisible = await this.isVisible(target); isStillVisible ? this.visible.emit()…

VIEW QUESTION
Back To Top
Search