File tree Expand file tree Collapse file tree 3 files changed +54
-13
lines changed
packages/polyfill/src/polyfills Expand file tree Collapse file tree 3 files changed +54
-13
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright 2018 Google Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import './promise' ;
18
+ import { global } from './global' ;
19
+
20
+ ( self => {
21
+ require ( 'whatwg-fetch' ) ;
22
+ } ) ( global ) ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright 2018 Google Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ const __global = ( ( ) => {
18
+ if ( typeof global !== 'undefined' ) {
19
+ return global ;
20
+ }
21
+ if ( typeof window !== 'undefined' ) {
22
+ return window ;
23
+ }
24
+ if ( typeof self !== 'undefined' ) {
25
+ return self ;
26
+ }
27
+ throw new Error ( 'unable to locate global object' ) ;
28
+ } ) ( ) ;
29
+
30
+ export const global = __global ;
Original file line number Diff line number Diff line change 14
14
* limitations under the License.
15
15
*/
16
16
17
- const __global = ( ( ) => {
18
- if ( typeof global !== 'undefined' ) {
19
- return global ;
20
- }
21
- if ( typeof window !== 'undefined' ) {
22
- return window ;
23
- }
24
- if ( typeof self !== 'undefined' ) {
25
- return self ;
26
- }
27
- throw new Error ( 'unable to locate global object' ) ;
28
- } ) ( ) ;
17
+ import { global } from './global' ;
29
18
30
19
// Polyfill Promise
31
20
if ( typeof Promise === 'undefined' ) {
32
21
// HACK: TS throws an error if I attempt to use 'dot-notation'
33
- __global [ 'Promise' ] = require ( 'promise-polyfill' ) as PromiseConstructor ;
22
+ global [ 'Promise' ] = require ( 'promise-polyfill' ) as PromiseConstructor ;
34
23
}
You can’t perform that action at this time.
0 commit comments