mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: game session start time stamp
This commit is contained in:
parent
800e99fda0
commit
188fe4537a
9 changed files with 45 additions and 34 deletions
|
@ -5,6 +5,7 @@ import { gameRepository } from "@main/repository";
|
|||
import { getProcesses } from "@main/helpers";
|
||||
import { WindowManager } from "./window-manager";
|
||||
import { createGame, updateGamePlaytime } from "./library-sync";
|
||||
import { RunningGameEvent } from "@types";
|
||||
|
||||
const gamesPlaytime = new Map<
|
||||
number,
|
||||
|
@ -96,10 +97,13 @@ export const watchProcesses = async () => {
|
|||
}
|
||||
|
||||
if (WindowManager.mainWindow) {
|
||||
const gamesRunningIds = Array.from(gamesPlaytime.keys());
|
||||
const runningGames = Array.from(gamesPlaytime.entries()).map((entry) => {
|
||||
return { id: entry[0], sessionStartTimestamp: entry[1].firstTick };
|
||||
});
|
||||
|
||||
WindowManager.mainWindow.webContents.send(
|
||||
"on-games-running",
|
||||
gamesRunningIds
|
||||
runningGames as RunningGameEvent
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue