I am using jquery for promises.
I have a scenario, where i have two promises.
If promise1 rejects or resolve then system1 should reject or resolve respectively.
If promise2 rejects or resolve, system2 should resolve.
Function X should be called after both are settled and both system1 and system2 has resolved.
I tried :
var dp = $.when(promise1, promise2);
dp.done(function(one,two){
X();
}).fail(function(){
// promise1 might have not settled as of yet.
Should call X or not ?
});
But it returns as soon as one of the promise fails. So my promise1 is not resolved at the time when my fail is called.
How do i do it ?