fix(plugin): revert to RegisterForGameStarted/Stopped for runtime compat
This commit is contained in:
@@ -42,15 +42,14 @@ function Content() {
|
||||
// ── Register SteamClient game events ──────────────────────────
|
||||
useEffect(() => {
|
||||
try {
|
||||
const startedReg = SteamClient.Apps.RegisterForGameActionStart(
|
||||
(_gameActionId: number, appId: string, _action: string, _source: number) => {
|
||||
const appIdNum = parseInt(appId, 10)
|
||||
onGameStart(appIdNum, `App ${appId}`)
|
||||
},
|
||||
)
|
||||
// Use RegisterForGameStarted/Stopped — these are the most widely used
|
||||
// APIs in Decky plugins despite TypeScript type warnings.
|
||||
const startedReg = SteamClient.Apps.RegisterForGameStarted((appId: number) => {
|
||||
onGameStart(appId, `App ${appId}`)
|
||||
})
|
||||
gameStartedUnregRef.current = startedReg
|
||||
|
||||
const stoppedReg = SteamClient.Apps.RegisterForGameActionEnd((_gameActionId: number) => {
|
||||
const stoppedReg = SteamClient.Apps.RegisterForGameStopped((_appId: number) => {
|
||||
onGameStop()
|
||||
})
|
||||
gameStoppedUnregRef.current = stoppedReg
|
||||
|
||||
Vendored
+6
@@ -5,6 +5,12 @@
|
||||
declare global {
|
||||
const SteamClient: {
|
||||
Apps: {
|
||||
RegisterForGameStarted: (
|
||||
callback: (appId: number) => void,
|
||||
) => { unregister: () => void }
|
||||
RegisterForGameStopped: (
|
||||
callback: (appId: number) => void,
|
||||
) => { unregister: () => void }
|
||||
RegisterForGameActionStart: (
|
||||
callback: (gameActionId: number, appId: string, action: string, source: number) => void,
|
||||
) => { unregister: () => void }
|
||||
|
||||
Reference in New Issue
Block a user