diff --git a/adapters/platforms/wechat/res/worker_adapter/asset-manager.js b/adapters/platforms/wechat/res/worker_adapter/asset-manager.js index f8e31f3b..5d0f92a4 100644 --- a/adapters/platforms/wechat/res/worker_adapter/asset-manager.js +++ b/adapters/platforms/wechat/res/worker_adapter/asset-manager.js @@ -16,11 +16,8 @@ var assetManagerWorkerAdapter = { }, // 添加缓存文件记录 addCachedFiles(args, cmdId, callback) { - const addedFiles = args[0]; - for (let i = 0, l = addedFiles.length; i < l; i++) { - const [id, cacheBundleRoot, localPath, time] = addedFiles[i]; - cc.assetManager.cacheManager.cachedFiles.add(id, { bundle: cacheBundleRoot, url: localPath, lastTime: time }); - } + const [id, cacheBundleRoot, localPath, time] = args[0]; + cc.assetManager.cacheManager.cachedFiles.add(id, { bundle: cacheBundleRoot, url: localPath, lastTime: time }); }, }; diff --git a/adapters/platforms/wechat/res/workers/cache-manager-worker.js b/adapters/platforms/wechat/res/workers/cache-manager-worker.js index 587d38f8..039246a6 100644 --- a/adapters/platforms/wechat/res/workers/cache-manager-worker.js +++ b/adapters/platforms/wechat/res/workers/cache-manager-worker.js @@ -189,7 +189,7 @@ var cacheManager_worker = { self.cachedFiles[id] = { bundle: cacheBundleRoot, url: localPath, lastTime: time }; delete self.cacheQueue[id]; self.writeCacheFile(); - // TODO main.assetManager.addCachedFiles([[id, cacheBundleRoot, localPath, time]]); + main.assetManager.addCachedFiles([id, cacheBundleRoot, localPath, time]); if (_callback) _callback(id, cacheBundleRoot, localPath, time); } if (!isEmptyObject(self.cacheQueue)) { @@ -334,7 +334,7 @@ var cacheManager_worker = { } self.cachedFiles[id] = { bundle: cacheBundleRoot, url: targetPath, lastTime: time }; self.writeCacheFile(); - main.assetManager.addCachedFiles([[id, cacheBundleRoot, targetPath, time]]); + main.assetManager.addCachedFiles([id, cacheBundleRoot, targetPath, time]); onComplete && onComplete(null, targetPath); }); },