小编rob*_*ler的帖子

用另一个承诺履行(不解决)承诺

我希望履行一些其他承诺的承诺.关键是我真的希望在第一个承诺完成后立即获得(仍在等待的)第二个承诺.不幸的是,一旦两个承诺都得到满足,我似乎只能获得第二个承诺的分辨率值.

这是我想到的用例:

var picker = pickFile();

picker.then(  // Wait for the user to pick a file.
    function(downloadProgress) {
        // The user picked a file. The file may not be available just yet (e.g.,
        // if it has to be downloaded over the network) but we can already ask
        // the user some more questions while the file is being obtained in the
        // background.

        ...do some more user interaction...

        return downloadProgress;
    }
).then( // Wait for the download …
Run Code Online (Sandbox Code Playgroud)

javascript ecmascript-6 es6-promise

7
推荐指数
1
解决办法
3235
查看次数

标签 统计

ecmascript-6 ×1

es6-promise ×1

javascript ×1