You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const clientEngine = new MyGameClientEngine(gameEngine, options);
clientEngine.start().then(()=>{
// This doesn't get executed because `ClientEngine.start` doesn't resolve
clientEngine.renderer.setupBackground();
clientEngine.renderer.setRendererSize();
}).catch(console.error);
It seems like a very bad idea to not resolve the promise immediately. (Not to mention that rejecting with undefined makes debugging a nightmare.)
I'd be willing to make a PR, but I wanted to discuss this first.
The text was updated successfully, but these errors were encountered:
This works because ClientEngine stores the resolve function from ClientEngine::start()'s promise in a class variable that only ever gets called during ClientEngine::step(), and even then only if GameEngine::getPlayerGameOverResult() returns a truthy value.
Hacky? Yes. But, it does cause ClientEngine::start()'s behavior to match the documentation, so... 🤷♀
this comment was edited to make the workaround more reliable
Can we please change the code of ClientEngine.start so that it resolves once it's ready?
I was extremely confused that this just wouldn't work:
Or this:
It seems like a very bad idea to not resolve the promise immediately. (Not to mention that rejecting with undefined makes debugging a nightmare.)
I'd be willing to make a PR, but I wanted to discuss this first.
The text was updated successfully, but these errors were encountered: