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
review(application): add isFullscreen, clean up the device fullscreen probes (#1467)
Round-out of the move to app-instance fullscreen:
- **`Application#isFullscreen`** added so the trio sits together
(`isFullscreen` / `requestFullscreen` / `exitFullscreen`). Defaults
the documented example to `app.isFullscreen()` instead of mixing
in `me.device.isFullscreen()`.
- **`device.isFullscreen` deprecated** alongside the other two
fullscreen statics. Same `since 19.7.0 — use Application#…`
pointer.
- The four example sites that still called `device.isFullscreen()`
switch to `_app.isFullscreen()` / `game.isFullscreen()` so the
fullscreen path is consistently app-instance in user-facing code.
- The new `Application#requestFullscreen` JSDoc names
`parentElement` directly (with a backlink to
{@link Application#getParentElement}) instead of the vaguer
"canvas parent element" phrasing.
Tag-along cleanup of the deprecated device wrappers themselves: the
`prefixed("fullscreenEnabled", ...)` / `prefixed("fullscreenElement",
...)` / `prefixed("requestFullscreen", ...)` calls iterated 5 vendor
prefixes per probe via the `prefixed()` helper, with awkward
`as unknown as Record<string, unknown>` casts. Replaced with an
explicit four-variant OR chain (`fullscreenEnabled || webkit… ||
moz… || ms…`), the same pattern lib.dom.d.ts uses and what every
MDN recipe recommends in 2026. `DocumentLegacy` / `ElementLegacy`
gain the missing `webkit*` / `ms*` typings. `requestFullscreen`
also `.catch()`-es the Promise the modern (unprefixed) call
returns — the vendor-prefixed variants returned undefined so the
guard `if (result instanceof Promise)` cleanly covers both.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: packages/melonjs/CHANGELOG.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@
35
35
-**`device.platform.isMobile` no longer ORs the dead-platform regexes** (#1467). `wp` / `BlackBerry` / `Kindle` regexes were burning cycles on every page load testing for hardware nobody ships (Windows Phone EOL 2017, BB10 EOL 2016, Kindle behaves like Android anyway). The remaining chain — `/Mobi/.test(ua) || iOS || android` — covers ~99.9% of mobile traffic in 2026 per MDN. The deprecated exports themselves still compute and return; only the `isMobile` aggregate stopped consulting them.
36
36
-**`initKeyboardEvent` no longer skips listener registration on `isMobile === true`** (#1467). The gate assumed "mobile = no physical keyboard" — invalid for iPads with Magic Keyboard (now correctly detected per the iPad fix above), Samsung DeX, ChromeOS tablet mode, Bluetooth-keyboard-on-phone, etc. Two empty listener slots cost nothing on touch-only devices; the unbound-key path is a single map lookup that returns undefined.
37
37
- **`system/device` converted to TypeScript** (#1467, renamed from `device.js` → `device.ts`). 945 lines / 53 exports / 56 JSDoc blocks of feature-detection helpers and platform plumbing now ship as a `.ts` file with native type signatures. JSDoc was already exhaustive, so the conversion is mostly mechanical — `@param {Type}` blocks become parameter annotations and `@type {Type}` constants get TS-inferred. Non-standard / legacy browser surfaces (`Document.mozFullScreenEnabled`, `Navigator.standalone` / `browserLanguage` / `userLanguage`, iOS-only `DeviceOrientationEvent.requestPermission`, deprecated `Screen.lockOrientation`, `webkitAudioContext`) are typed via narrow local intersection types declared at the top of the file. Behavioural parity verified against the full 3975-test suite; downstream call sites (`pointerevent.ts`, `application.ts`, `resize.ts`, `header.ts`, etc.) are unchanged thanks to bundler-resolution rewriting `.js` imports to `.ts` source. One small correctness improvement fell out of the conversion: `onDeviceMotion` now guards against `accelerationIncludingGravity === null` rather than crashing.
38
-
-**`Application#requestFullscreen` / `Application#exitFullscreen`** — fullscreen control finally has app-instance context. Defaults to fullscreening the app's `parentElement` (so the canvas + any sibling HUD go fullscreen together); accepts an optional `Element` override. The two examples that wire `F` → toggle fullscreen (platformer + platformer-matter) migrate to the new API. No deprecated `getParent()` / global-game lookup involved — the canonical fullscreen path now reaches the canvas through the Application it was created on.
38
+
-**`Application#requestFullscreen` / `Application#exitFullscreen` / `Application#isFullscreen`** — fullscreen control finally has app-instance context. `requestFullscreen` defaults to the app's `parentElement` (the container the canvas was appended into — `getParentElement()`), so the canvas plus any sibling HUD / overlay markup inside that container go fullscreen together; accepts an optional `Element` override. `isFullscreen` is the matching probe (delegates to the underlying document check). The two examples that wire `F` → toggle fullscreen (platformer + platformer-matter) migrate to the new API. No deprecated `getParent()` / global-game lookup involved — the canonical fullscreen path now reaches the canvas through the Application it was created on.
39
39
40
40
### Deprecated
41
41
-**`device.requestFullscreen()` / `device.exitFullscreen()`** (#1467, since 19.7.0). Use `app.requestFullscreen()` / `app.exitFullscreen()` instead. The device wrappers still work for backwards compat through the 19.x line but rely on the deprecated global-game canvas lookup (`getParent()` → `game.getParentElement()`, deprecated since 18.3.0).
// eslint-disable-next-line @typescript-eslint/no-deprecated -- this whole function is the deprecated wrapper; internal use of the matching deprecated probe is fine
455
461
if(hasFullscreenSupport&&!isFullscreen()){
456
462
// eslint-disable-next-line @typescript-eslint/no-deprecated -- no Application context available from this static API
@@ -469,6 +478,7 @@ export function requestFullscreen(element?: Element) {
469
478
* @deprecated since 19.7.0 — use {@link Application#exitFullscreen app.exitFullscreen()} instead.
470
479
*/
471
480
exportconstexitFullscreen=()=>{
481
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- this whole function is the deprecated wrapper; internal use of the matching deprecated probe is fine
0 commit comments