fix wechat loading issue (#4874)

* fix wechat loading issue

* refine
This commit is contained in:
Santy-Wang
2019-07-12 17:55:02 +08:00
committed by Jare Guo
parent a8bcec90a5
commit aca1396608
2 changed files with 8 additions and 18 deletions
+2 -18
View File
@@ -34,7 +34,7 @@ import * as PackDownloader from './pack-downloader';
import downloadBinary from './binary-downloader';
import downloadText from './text-downloader';
import downloadAudio from './audio-downloader';
import {urlAppendTimestamp, decompressJson} from './utils';
import {urlAppendTimestamp} from './utils';
function skip () {
return null;
@@ -118,23 +118,7 @@ function downloadImage (item, callback, isCrossOrigin, img) {
function downloadUuid (item, callback) {
var result = PackDownloader.load(item, callback);
if (result === undefined) {
return this.extMap['json'](item, function (err, text) {
var out = null;
if (!err) {
try {
out = JSON.parse(text);
if (!CC_DEBUG && out.keys && out.data) {
var keys = out.keys;
out = out.data;
decompressJson(out, keys);
}
}
catch (e) {
err = new Error(debug.getError(4923, item.id, e.stack));
}
}
callback(err, out);
});
return this.extMap['json'](item, callback);
}
return result || undefined;
}
+6
View File
@@ -33,6 +33,7 @@ import {_getClassById} from '../core/utils/js';
import * as debug from '../core/platform/CCDebug';
import deserialize from '../core/data/deserialize';
import LoadingItems from './loading-items';
import {decompressJson} from './utils';
export function isSceneObj (json) {
var SCENE_ID = 'cc.Scene';
@@ -221,6 +222,11 @@ export function loadUuid (item, callback) {
if (typeof item.content === 'string') {
try {
json = JSON.parse(item.content);
if (!CC_DEBUG && json.keys && json.data) {
var keys = json.keys;
json = json.data;
decompressJson(json, keys);
}
}
catch (e) {
return new Error(debug.getError(4923, item.id, e.stack));