1 Star 0 Fork 0

RN鸿蒙化项目团队/ty-react-native-blob-util

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
json-stream.js 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
import Oboe from './lib/oboe-browser.min.js';
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 ReactNativeBlobUtil.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;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/rn-mi/ty-react-native-blob-util.git
git@gitee.com:rn-mi/ty-react-native-blob-util.git
rn-mi
ty-react-native-blob-util
ty-react-native-blob-util
master

搜索帮助