Created
October 25, 2016 13:51
-
-
Save twicejr/3d79c83041ba940a1ffea5202148b10b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class MyApp { | |
_initDb() { | |
var promised = []; | |
promised.push(new Promise((resolve, reject) => { | |
alert('wait 1.....'); | |
return resolve(true); | |
})); | |
promised.push(new Promise((resolve, reject) => { | |
return resolve(true); | |
})); | |
promised.push(new Promise((resolve, reject) => { | |
if(confirm('resolve this one?)){ | |
return resolve(true); | |
} | |
return reject(false); | |
})); | |
return Promise.all(promised).then((success) => { | |
return Promise.resolve(success); | |
}, (error) => { | |
return Promise.reject(error); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment