22 lines
507 B
JavaScript
22 lines
507 B
JavaScript
import Promise from './index';
|
|
|
|
var globalNS = (function() {
|
|
// the only reliable means to get the global object is
|
|
// `Function('return this')()`
|
|
// However, this causes CSP violations in Chrome apps.
|
|
if (typeof self !== 'undefined') {
|
|
return self;
|
|
}
|
|
if (typeof window !== 'undefined') {
|
|
return window;
|
|
}
|
|
if (typeof global !== 'undefined') {
|
|
return global;
|
|
}
|
|
throw new Error('unable to locate global object');
|
|
})();
|
|
|
|
if (!globalNS.Promise) {
|
|
globalNS.Promise = Promise;
|
|
}
|