3 ms·
Perhaps the gp meant this case? something().then(function(){ setTimeout(function(){ whoops_not_a_function(); }, 1000); }).cat
by dmethvin 11y ago
Perhaps the gp meant this case?
something().then(function(){
setTimeout(function(){
whoops_not_a_function();
}, 1000);
}).catch(function(){
// nope, nothing to catch
});
- phs2501 11y agoNo built-in help with native promises, but with something like Bluebird you'd prefer: something().then(() => { return Promise.delay(1000).then(() => { whoops_not_a_function(); }); }).catch(() => { // whoops_not_a_function is not defined }); ...or write Promise_delay yourself on top of native promises (but really just use Bluebird).
- linkmotif 11y agoYup this is what I meant. Thanks. Yeah arrow functions help.