How to wait for result of two promises, then do something?

后端 未结 2 1654
孤城傲影
孤城傲影 2021-01-24 13:17

Well, subject. Can\'t figure out...

Condition: both promises start asynchronously and not one after another. Like this:

spashGoing.then(         


        
2条回答
  •  悲&欢浪女
    2021-01-24 13:46

    If WinJS promises are Promise/A+ promises

    Promise.all([
        spashGoing.then(doSomethingForItself), 
        writingGoing.then(doSomethingForItself2)
    ]).then(function(results) {
        // do things with results
    });
    

    Well, answered too soon - WinJS promises are a typical example of Microsoft's "let's do things just a little different" attitude towards the web

提交回复
热议问题