Promise library wrapper and polyfill