RxJS: MergeMap with Preserving Input order

后端 未结 3 1051
悲哀的现实
悲哀的现实 2021-01-07 03:04

Requirement:

urls = [url1, url2, url3]

Fire all 3 urls parallely and paint the Dom in the sequnce of the urls list

 ex: Fini         


        
3条回答
  •  Happy的楠姐
    2021-01-07 03:33

    You can form a sequence with fetch and paint then forkJoin/Promise.all them

    p1 = fetch(url1)
    p2 = fetch(url2)
    p3 = fetch(url3)
    
    forkJoin(
    from(p1).pipe(tap(_=>paint dom...))
    from(p1).pipe(tap(_=>paint dom...))
    from(p1).pipe(tap(_=>paint dom...))
    ).subscribe()
    

提交回复
热议问题