Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_prepared is never set to true when js-files are minimized (project.json does not contain a jsList) #3536

Open
hamburml opened this issue Oct 25, 2017 · 1 comment

Comments

@hamburml
Copy link

_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!

@hamburml hamburml changed the title _prepared is never set to true when js-files are minimized _prepared is never set to true when js-files are minimized (project.json does not contain a jsList) Oct 25, 2017
@maximdrozd
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants