ES6: Promisifying The Native Way (with Strophe as example)
Originally published at www.melvinkoh.me.
Before ES6 provides us the native support of Promise, we rely on third-party libraries like Bluebird to enable this useful mechanism. In this post, we will see how we can promisify callback-based API in the ES6 native way and avoiding a common anti-pattern.
What is Promisify?
Promisify is to refactor conventional Callback-based API into Promise-based API.