waitUntil created by leodotng - https://repl.it/K6U9/1
function waitUntil(num, str) {
//inside here we'll do a standard set time document
var promise = new Promise(function(resolve, reject) {
setTimeout(function() {
resolve(str);
}, num);
});
return promise;
}
waitUntil(2000, 'hello')
.then(function(res) {
console.log(res);
return waitUntil(1000, 'world');
})
.then(function(res) {
console.log(res);
return waitUntil(55, '!');
})
.then(function(res) {
console.log(res);
});
//Making calls to weather api, waiting for weather data from other website.