我希望履行一些其他承诺的承诺.关键是我真的希望在第一个承诺完成后立即获得(仍在等待的)第二个承诺.不幸的是,一旦两个承诺都得到满足,我似乎只能获得第二个承诺的分辨率值.
这是我想到的用例:
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)