Skip to content

Remove dead window load listener in a-scene - #5868

Open
vincentfretin wants to merge 1 commit into
aframevr:masterfrom
vincentfretin:remove-dead-load-listener
Open

vincentfretin wants to merge 1 commit into
aframevr:masterfrom
vincentfretin:remove-dead-load-listener

Conversation

@vincentfretin

Copy link
Copy Markdown
Contributor

attachedCallbackPostCamera registered window.addEventListener('load', resize) with resize an undefined local variable, so it never did anything (it has been like this since the WebVR 1.0 changes in 2016).

Replacing it with self.resize wouldn't help either: elements initialize after aframeready, emitted once the document readyState is complete, and attachedCallbackPostCamera runs when the camera is ready, so the window load event has already fired when the listener would be added. The scene is already resized when the renderer is set up, after the canvas is created, when rendering starts, on enter/exit VR and on window resize.

Found while reviewing the patches of 8th Wall's 8-Frame fork, which had changed this line to self.resize (https://github.com/orgs/8thwall/discussions/300).

🤖 Generated with Claude Code

attachedCallbackPostCamera registered window.addEventListener('load', resize)
with `resize` an undefined local variable, so it did nothing. Calling
self.resize there wouldn't help either: elements initialize after
aframeready, emitted once the document readyState is complete, and
attachedCallbackPostCamera runs when the camera is ready, so the window
load event has already fired. The scene is resized when the renderer is
set up, after the canvas is created, when rendering starts, on enter and
exit VR and on window resize.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant