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

Feature request - Suppress canvas injection from the Engine constructor #2970

Open
ewal opened this issue Mar 16, 2024 · 4 comments
Open

Feature request - Suppress canvas injection from the Engine constructor #2970

ewal opened this issue Mar 16, 2024 · 4 comments
Labels
bug This issue describes undesirable, incorrect, or unexpected behavior feature Label applied to new feature requests

Comments

@ewal
Copy link

ewal commented Mar 16, 2024

Context

When creating a new instance of the Engine the canvas element is automatically injected into the DOM and this behavior can cause problems if the document is not yet ready.

Proposal

By allowing manual mounting/injecting of the canvas element, we will have more control of the flow, eg.the game could be constructed before being used.

I ran into the problem with the document not being ready when wanted to prepare an exported game instance.

@eonarheim
Copy link
Member

@ewal This is a great feature idea! I 100% support this

@eonarheim eonarheim added the feature Label applied to new feature requests label Mar 16, 2024
@eonarheim
Copy link
Member

eonarheim commented Mar 16, 2024

@ewal As a possible workaround you can supply the canvasElementId to the engine constructor and it will use a canvas that is defined in the DOM

@ewal
Copy link
Author

ewal commented Mar 16, 2024

@ewal As a possible workaround you can supply the canvasElementId to the engine constructor and it will use a canvas that is defined in the DOM

Thanks for the reply, @eonarheim. I tried specifying the canvasElementId but I still face the same problem since the code tries to find the element on line 760 in Engine.ts with the document being undefined.

@eonarheim
Copy link
Member

@ewal AH! Good find, that definitely is a bigger problem for sure. I'll bump this in priority on my list!

@eonarheim eonarheim added the bug This issue describes undesirable, incorrect, or unexpected behavior label Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes undesirable, incorrect, or unexpected behavior feature Label applied to new feature requests
Projects
None yet
Development

No branches or pull requests

2 participants