feat(types): execInPage, onRequest & party APIs + supports() capability helper#10933
Merged
Conversation
…rap in supports() check
Bas950
requested changes
Jun 24, 2026
Type execInPage's rest args as a tuple generic (A extends unknown[]) so the values passed are forwarded to the closure with their types instead of erasing to unknown[]. Applies to both Presence and iFrame overloads. Addresses review feedback on #10933.
Bas950
approved these changes
Jun 24, 2026
auto-merge was automatically disabled
June 24, 2026 21:52
Pull request was converted to draft
- presence-class (API + guide): detailed execInPage (function + declarative ExecInPageSpec forms) and onRequest (RequestFilter, InterceptedRequest, unsubscribe), both gated behind the supports() helper. - presence-data: party / PartyData (only honored on ActivityType.Playing). - utility-functions: supports() capability-detection helper. - iframe: execInPage reference. For #10933.
skullysmods
approved these changes
Jun 25, 2026
Bas950
reviewed
Jun 26, 2026
Comment on lines
+457
to
+460
| /** Only keep these top-level keys of the result. */ | ||
| pick?: string[] | ||
| /** Drop these top-level keys from the result. */ | ||
| omit?: string[] |
Member
Author
There was a problem hiding this comment.
Good call — done. pick/omit now accept dot-paths (not just top-level keys), matching get/call.
Runtime change in PreMiD/Extension#780: resolvePickOmit routes keys through dot-prop, so e.g. pick: ['track.name'] narrows a call result to { track: { name } } — which previously had no CSP-immune form (get can't invoke, top-level pick keeps the whole track). The filter runs on the serialized clone, so dot-path omit can't mutate page objects. Types + docs updated here in cac217e.
pick/omit accept dot-paths in the runtime (PreMiD/Extension#780); document the nested-field capability on the type and in the API reference.
Bas950
pushed a commit
that referenced
this pull request
Jul 1, 2026
…10944) * fix: query selector for video detection * chore: remove console log * feat(types): add execInPage and onRequest APIs to Presence/iFrame * docs(types): document feature-detection for execInPage/onRequest on older extensions * feat(premid): add supports() helper for version-safe capability detection * feat(lint): error on unguarded execInPage/onRequest with autofix to wrap in supports() check * feat(types): add party to PresenceData (2.14.0) * fix(types): infer execInPage arg types into the page closure Type execInPage's rest args as a tuple generic (A extends unknown[]) so the values passed are forwarded to the closure with their types instead of erasing to unknown[]. Applies to both Presence and iFrame overloads. Addresses review feedback on #10933. * feat(FACEIT): expand presence handling and user state detection feat(i18n): add and refine localized FACEIT strings for browsing, matchroom, and party states feat(party): add support for party states (189fefc) feat(settings): update browsing and add elo, party info, and in-game presence title settings fix(assets): switch elo rank 1-11 to better quality images fix(queue): fix In Queue state not working * feat(FACEIT): bump metadata version * fix: resize icons from 38x38 to 512x512 * fix: party state if inviting a player --------- Co-authored-by: Florian Metz <me@timeraa.dev>
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.
What
Adds the activity-facing types and tooling for three new
Presence/iFramecapabilities, plus a runtime feature-detection helper so activities can adopt them safely today.execInPage— run a function (or a declarative, CSP-immuneget/callspec) in the page's own context and await a returned value.onRequest— read data out of page network requests via a URL/method filter (read-only, no modification).partyonPresenceData— show a party size on Playing activities (e.g. "2 of 5");partyIdoptional, only honored onActivityType.Playing.supports(target, feature)— bundled into the activity, returnstruewhen the running extension exposes the capability. Lets activities feature-detect instead of crashing on older installs.execInPage/onRequestusage, with an autofix that wraps the call in asupports()check.Versioning
These APIs ship with the extension in 2.14.0. They can be used as of right now: because
supports()is compiled into the activity bundle, it detects the capability at runtime, so an activity guarded withsupports()works on 2.14.0+ and degrades gracefully (no-op) on older extensions instead of throwing. The lint rule enforces that guard.