Open hamburml opened 7 years ago
Maybe a better approach would be adding a method to cc.game called isReady() to indicate if everything is loaded. _prepared is "private" var (starts with underscore by convention) - I would no rely on it for any sort of info.
_prepared is set to false when created (https://github.com/cocos2d/cocos2d-html5/blob/develop/CCBoot.js#L2365)
_prepared is set to true when the project.json file has a jsList which is loaded AFTER the cocos2d-html5 files were loaded (https://github.com/cocos2d/cocos2d-html5/blob/develop/CCBoot.js#L2553)
When everything (the game js-files and the framework-js-files) is minimized, the project.json jsList is empty and therefore _prepared will never be set to true. Normally this is no problem but we use
cc.game._prepared
in our game (webworkers) to check if the engine is prepared (everything is loaded).I am not sure but it should be sufficient if
self._prepared = true
is set here https://github.com/cocos2d/cocos2d-html5/blob/develop/CCBoot.js#L2563 or the project.json contains"jsList": []
.What do you say?
Thanks!