Commit 64afd51d authored by liujiangnan's avatar liujiangnan

debug

parent 1291ed9c
...@@ -43,6 +43,27 @@ cc.Class({ ...@@ -43,6 +43,27 @@ cc.Class({
}); });
}, },
callNetworkApiGetLocal(baseUrl, uri, data, callBack) {
let queryStr = '?';
const params = [];
for (const key in data) {
if (Object.hasOwnProperty.call(data, key)) {
params.push(`${key}=${data[key]}`);
}
}
queryStr += params.join("&");
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = () => {
if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)) {
callBack(xhr.responseText);
}
};
const url = `${baseUrl}${uri}${queryStr}`;
console.log('url = ' + url);
xhr.open('GET', url, true);
xhr.send();
},
// 需要预加载的数量 // 需要预加载的数量
preloadCount: null, preloadCount: null,
// 统计已加载的数量 // 统计已加载的数量
...@@ -455,7 +476,7 @@ cc.Class({ ...@@ -455,7 +476,7 @@ cc.Class({
}); });
}, },
loadLocalBundle(address, port) { loadLocalBundle(address, port) {
this.callNetworkApiGet(`http://${address}:${port}`, '/dist/config.json', {}, (datastr) => { this.callNetworkApiGetLocal(`http://${address}:${port}`, '/dist/config.json', {}, (datastr) => {
const data = JSON.parse(datastr); const data = JSON.parse(datastr);
let sceneName = ''; let sceneName = '';
let version = ''; let version = '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment