@Howrad wrote:
Try the following code:
onLoad: function () { cc.loader.loadRes("datafile", function(error, data) { console.log("before"); undefinedVariable.property; console.log("after"); }); },
If
assets/resources/datafile.json
does not exist (that is, it's a loading failure), the console output, either in the browser or the simulator, will be:before ReferenceError: undefinedVariable is not defined
If
assets/resources/datafile.json
exists, the console output, either in the browser or the simulator, will be:before
So if it loads the file, Cocos will suppress all errors inside that completeCallback, failing silently.
Posts: 1
Participants: 1