Skip to content

Instantly share code, notes, and snippets.

@twicejr
Created October 25, 2016 13:51
Show Gist options
  • Save twicejr/3d79c83041ba940a1ffea5202148b10b to your computer and use it in GitHub Desktop.
Save twicejr/3d79c83041ba940a1ffea5202148b10b to your computer and use it in GitHub Desktop.
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