How to use the finalize function from rxjs

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

43
44
45
46
47
48
49
50
51
52
    limiter$: (observable$, id = uuid(), username) => {
        const stop$ = new Subject()
        return service.submit$(limiterService, {id, username: username || 'ANON'}).pipe(
            takeUntil(stop$),
            mergeMap(() => observable$.pipe(
                finalize(() => stop$.next())
            ))
        )
    }
}
fork icon45
star icon178
watch icon34

111
112
113
114
115
116
117
118
119
120
        getInstance$().pipe(
            switchMap(instance =>
                concat(of(instance), NEVER).pipe(
                    tap(instance => lock(instance)),
                    map(({item}) => item),
                    finalize(() => release(instance))
                )
            )
        )
}
fork icon45
star icon178
watch icon34

217
218
219
220
221
222
223
224
225
226
    )
}

return from(init()).pipe(
    switchMap(() => out$.pipe(
        finalize(
            () => stop$.next()
        )
    ))
)
fork icon45
star icon177
watch icon0