How to use the scan function from rxjs

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

74
75
76
77
78
79
80
81
82
83

const downloadFiles$ = ({files, prefix, downloadDir, deleteAfterDownload}) => {
    return of(files).pipe(
        switchMap(files => of(...files)),
        mergeMap(file => downloadFile$({file, prefix, downloadDir, deleteAfterDownload}), CONCURRENT_FILE_DOWNLOAD),
        scan((currentProgress, fileProgress) => getProgress({
            files,
            currentProgress,
            fileProgress
        }), initialState(files))
fork icon45
star icon178
watch icon34