Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix can't find variable self in Oboe #825

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 31 additions & 37 deletions json-stream.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
import Oboe from './lib/oboe-browser.min.js'
import XMLHttpRequest from './polyfill/XMLHttpRequest'
import URIUtil from './utils/uri'
import Oboe from "oboe";
import XMLHttpRequest from "./polyfill/XMLHttpRequest";
import URIUtil from "./utils/uri";

const OboeExtended = (arg: string | Object) => {
window.location = "";

if (!window.XMLHttpRequest.isRNFBPolyfill) {
window.XMLHttpRequest = XMLHttpRequest;
console.warn(
"Use JSONStream will automatically replace window.XMLHttpRequest with RNFetchBlob.polyfill.XMLHttpRequest. " +
"You are seeing this warning because you did not replace it manually."
);
}

window.location = ''
if (typeof arg === "string") {
if (URIUtil.isFileURI(arg)) {
arg = {
url: "JSONStream://" + arg,
headers: { noCache: true },
};
} else arg = "JSONStream://" + arg;
} else if (typeof arg === "object") {
let headers = arg.headers || {};
if (URIUtil.isFileURI(arg.url)) {
headers.noCache = true;
}
arg = Object.assign(arg, {
url: "JSONStream://" + arg.url,
headers,
});
}
return Oboe(arg);
};

if(!window.XMLHttpRequest.isRNFBPolyfill ) {
window.XMLHttpRequest = XMLHttpRequest
console.warn(
'Use JSONStream will automatically replace window.XMLHttpRequest with RNFetchBlob.polyfill.XMLHttpRequest. ' +
'You are seeing this warning because you did not replace it manually.'
)
}

if(typeof arg === 'string') {
if(URIUtil.isFileURI(arg)) {
arg = {
url : 'JSONStream://' + arg,
headers : { noCache : true }
}
}
else
arg = 'JSONStream://' + arg

}
else if(typeof arg === 'object') {
let headers = arg.headers || {}
if(URIUtil.isFileURI(arg.url)) {
headers.noCache = true
}
arg = Object.assign(arg, {
url : 'JSONStream://' + arg.url,
headers
})
}
return Oboe(arg)
}

export default OboeExtended
export default OboeExtended;
Loading