什么是JavaScript中的Promise $ 2?

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

我正在使用Dropbox API从我拥有的照片文件夹中获取文件,而我最终想要做的是获取每个文件的临时链接。这是我的代码 - 如果有帮助,我也使用React:

componentDidMount() {
    dbx.filesListFolder({ path: '/my-photos' })
    .then(res => res.entries.map(file => file.path_display))
    .then(res => {
        let photoArray = res.map(path => dbx.filesGetTemporaryLink({ path: path }));
        console.log(photoArray);
    });
}

这就是我在开发控制台上看到的内容。 enter image description here

我在_result对象中收到了temp,但似乎我不应该访问它。

谁能告诉我Promise $ 2的含义以及如何解决这个问题?

javascript arrays api promise dropbox
1个回答
2
投票

Promise$2是来自promise库的Promise构造函数的名称,它与其他模块捆绑在一起,并在此过程中由转换器重命名,以避免与其他Promise变量(最值得注意的是全局变量)发生冲突。

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