function flatPromise() {
  let resolveFn
  let rejectFn
  const p = new Promise((resolve, reject) => {
    resolveFn = resolve
    rejectFn = reject
  })

  return [p, resolveFn, rejectFn]
}
Create a promise and obtain the resolve/reject functions
outside of the Promise callback.