Sawtaytoes
3/2/2019 - 6:01 AM

ES2018's Promise Finally Method

Promise
.resolve('Value')
.finally(() => {
  console
  .log('Done Processing 1')
})
.then(value => {
  console
  .log(value)
  
  return value
})
.then(value => {
  throw value
})
.finally(() => {
  console
  .log('Done Processing 2')
})
.catch(value => {
  console
  .warn(value)
})
.finally(() => {
  console
  .log('Done Processing 3')
})

// Done Processing 1
// Value
// Done Processing 2
// WARN: Value
// Done Processing 3