const whereIsMyCoffeeOrder = function(orderId) {
return new Promise((resolve, reject) => {
coffeeApi.checkStatus(orderId, (error, coffeeStatus) => {
if (error) {
// Promise fails
reject(error)
} else {
// Promise is fulfilled
resolve(coffeeStatus)
}
})
})
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter