How to Determine a JavaScript Promise’s Status

Promises have changed the landscape of JavaScript. Many old APIs have been reincarnated to use Promises (XHR to fetch, Battery API), while new APIs trend toward Promises. Developers can use async/await to handle promises, or then/catch/finally with callbacks, but what Promises don’t tell you is their status. Wouldn’t it be great if the Promise.prototype provided developers a status property to know whether a promise is rejected, resolved, or just done? My research led me to this gist which I found quite clever. I took some time to modify a bit of code and add comments. The following solution provides helper methods for determining a Promise’s status: // Uses setTimeout with... more →
Posted in: JavaScript

Apple acknowledges Whidbey map errors, promises app fix – Whidbey News-Times (subscription)

Apple acknowledges Whidbey map errors, promises app fixWhidbey News-Times (subscription)After three years of complaints, tech giant Apple, Inc. acknowledged two major Whidbey Island errors on its mobile map program this week and promised to have at least one of the problems fixed within two months. Island County Commissioner Helen Price … map app – Google News… more →
Posted in: Interactive Maps