UNPKG

1.42 kBJavaScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @flow strict-local
8 * @format
9 */
10'use strict';
11
12const {polyfillGlobal} = require('PolyfillFunctions');
13
14/**
15 * Set up XMLHttpRequest. The native XMLHttpRequest in Chrome dev tools is CORS
16 * aware and won't let you fetch anything from the internet.
17 *
18 * You can use this module directly, or just require InitializeCore.
19 */
20polyfillGlobal('XMLHttpRequest', () => require('XMLHttpRequest'));
21polyfillGlobal('FormData', () => require('FormData'));
22
23polyfillGlobal('fetch', () => require('fetch').fetch); // flowlint-line untyped-import:off
24polyfillGlobal('Headers', () => require('fetch').Headers); // flowlint-line untyped-import:off
25polyfillGlobal('Request', () => require('fetch').Request); // flowlint-line untyped-import:off
26polyfillGlobal('Response', () => require('fetch').Response); // flowlint-line untyped-import:off
27polyfillGlobal('WebSocket', () => require('WebSocket'));
28polyfillGlobal('Blob', () => require('Blob'));
29polyfillGlobal('File', () => require('File'));
30polyfillGlobal('FileReader', () => require('FileReader'));
31polyfillGlobal('URL', () => require('URL').URL); // flowlint-line untyped-import:off
32polyfillGlobal('URLSearchParams', () => require('URL').URLSearchParams); // flowlint-line untyped-import:off