Remove passive event listener detection and platform.passiveEvents - #9252
Merged
Conversation
Passive event listeners shipped in every browser years before WebGL2, which the engine requires, so the detectPassiveEvents probe in platform.js (which also relied on the legacy null-listener trick) can never return false in any environment able to run the engine. platform.passiveEvents remains on the platform namespace as a literal true for backwards compatibility. The four listener attach/detach sites in Mouse and ElementInput now pass their options objects directly, and Mouse no longer needs the platform import. Behavioural note: in Node and worker environments (no window) the probe used to throw and report false; the flag now reads true there as well. The only consumers are browser-only listener paths, so nothing changes in practice. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Build size reportThis PR changes the size of the minified bundles.
|
A GitHub-wide code search finds no application usage (the only matches are an engine fork's copy of the internal call sites), the flag was @ignore'd and thus undocumented, and reading the removed property degrades benignly: undefined is falsy, so any copied ternary falls back to the boolean-capture listener form, which works in every browser. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…laycanvas/engine into remove-passive-event-detection
ElementInput used opts where Mouse uses options, and was missing the AddEventListenerOptions type annotation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
detectPassiveEvents()inplatform.jsprobes whether the browser supports passive event listeners — a feature that shipped in every browser (Chrome 51, Firefox 49, Safari 10) years before WebGL2, which the engine requires. The probe can never return false in any environment able to run the engine, and it relies on the legacyaddEventListener('testpassive', null, opts)null-listener trick.platform.passiveEventsflag are removed entirely.Mouse#attach/detach,ElementInput#attach/detach) pass their options objects directly instead of branching on the flag.Mouseno longer needs itsplatformimport.Why full removal rather than keeping the flag or tagging it
@deprecated: the flag was@ignore'd (never documented), a GitHub-wide code search forplatform.passiveEventsfinds zero application usage (the only two matches are an engine fork's copy of these same internal call sites), and the failure mode is benign — reading the removed property yieldsundefined, so any copied ternary degrades to the boolean-capture listener form, which is valid in every browser. Nothing can crash.Verified: lint clean; full unit suite 2337 passing with failures identical to the
mainbaseline.Checklist
🤖 Generated with Claude Code