switchMap内部的返回对象

问题描述 投票:0回答:1

我是rjxs编程的新手,所以想知道如何执行以下操作。

    const downloadUrls$: any = filelist.map((file: any) => {
      const fileName = ...
      const path = ...
      const fileRef = ....
      const task: any = ...

      // get notified when the download URL is available
      return task.snapshotChanges().pipe(
        filter(snap => snap.state === TaskState.SUCCESS),
        switchMap(() => from(fileRef.getDownloadURL()))
      );
    });

因此,在上面的代码中,代替执行from(fileRef.getDownloadURL())的是,我有一种方法可以像下面那样创建对象,并且返回将是下面对象的列表。

             from (
                {
                 name: fileName,
                 filepath: fileRef.getDownloadURL(),
                 relativePath: path
                }
              )

方法签名

 `.getDownloadURL(): Observable<any>`  

我是rjxs编程的新手,所以想知道如何执行以下操作。 const downloadUrls $:any = filelist.map((file:any)=> {const fileName = ... const path = ... const ...

rxjs rxjs5 rxjs6 switchmap
1个回答
0
投票

我没有从您提供的代码中可运行的任何东西,所以我只是作为一个概念来编写它。

© www.soinside.com 2019 - 2024. All rights reserved.