CocosCreator 2.3.2
for (let dir of dirs) {
await this.loadResPromise(dir.path)
}
private loadResPromise(dir: string): Promise<void> {
return new Promise((resolve, reject) => {
cc.loader.loadResDir(dir, (err, assets, urls) => {
if (err) {
cc.log(`[路径资源加载] 错误 ${err}`)
resolve(null)
} else {
resolve()
}
})
})
}
错误消息
loading-items.js:513 Uncaught RangeError: Maximum call stack size exceeded
at LoadingItems.221.proto._childOnProgress (loading-items.js:513)
at LoadingItems.onProgress (CCLoader.js:313)
at LoadingItems.221.proto._childOnProgress (loading-items.js:516)
at LoadingItems.onProgress (CCLoader.js:313)
at LoadingItems.221.proto._childOnProgress (loading-items.js:516)
at LoadingItems.onProgress (CCLoader.js:313)
at LoadingItems.221.proto._childOnProgress (loading-items.js:516)
at LoadingItems.onProgress (CCLoader.js:313)
at LoadingItems.221.proto._childOnProgress (loading-items.js:516)
at LoadingItems.onProgress (CCLoader.js:313)
我不得其解,循环使用异步的方式去加载没有问题,但是通过我promise的方式就会出现这种错误!