MCPcopy Create free account
hub / github.com/Lobos/react-ui / createCORSRequest

Function createCORSRequest

src/utils/upload.js:3–17  ·  view source on GitHub ↗
(method, url)

Source from the content-addressed store, hash-verified

1'use strict';
2
3function createCORSRequest(method, url) {
4 var xhr = new XMLHttpRequest();
5 if ('withCredentials' in xhr) {
6 // XHR for Chrome/Firefox/Opera/Safari.
7 xhr.open(method, url, true);
8 } else if (typeof XDomainRequest !== 'undefined') {
9 // XDomainRequest for IE.
10 xhr = new XDomainRequest();
11 xhr.open(method, url);
12 } else {
13 // CORS not supported.
14 xhr = null;
15 }
16 return xhr;
17}
18
19function ajaxUpload({url, name, cors, file, onProgress, onLoad, onError, withCredentials}) {
20 let data = new FormData();

Callers 1

ajaxUploadFunction · 0.85

Calls 1

openMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…