2 import Promise from './promise';
4 export default function polyfill() {
7 if (typeof global !== 'undefined') {
9 } else if (typeof self !== 'undefined') {
13 local = Function('return this')();
15 throw new Error('polyfill failed because global object is unavailable in this environment');
19 var P = local.Promise;
21 if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {
25 local.Promise = Promise;