Basically, I have a function that returns a promise and calling finally()
doesn't appear to be working on Edge. It is fine in IE11 (weird huh?) The rest of the Promise API works great. I read this could be a bug with either Edge or the Babel Polyfill and a workaround is to wrap it somehow, but I have not seen a code example.
API
I have an API that returns a promise
/**
* Return a promise containing a single employee.
*
* @param {string} [employeeID] The employeeID.
*
* @return {promise} The promise.
*/
export function getEmployee(employeeID) {
return fetch(api + "?employeeID=" + employeeID)
.then((resp) => {
return resp.json();
});
}
Calling Code
getEmployee(this.props.id)
.then((json) => {
this.setState({
// do some stuff
});
})
.finally(() => { });
Notes
- Using Babel Polyfill
- Using WhatWG Fetch
- Using Webpack
Error
SCRIPT438: Object doesn't support property or method 'finally'