mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
21 lines
587 B
TypeScript
21 lines
587 B
TypeScript
import { registerEvent } from "../register-event";
|
|
import { gamesSublevel, downloadsSublevel, levelKeys } from "@main/level";
|
|
import type { GameShop } from "@types";
|
|
|
|
const getGameByObjectId = async (
|
|
_event: Electron.IpcMainInvokeEvent,
|
|
shop: GameShop,
|
|
objectId: string
|
|
) => {
|
|
const gameKey = levelKeys.game(shop, objectId);
|
|
const [game, download] = await Promise.all([
|
|
gamesSublevel.get(gameKey),
|
|
downloadsSublevel.get(gameKey),
|
|
]);
|
|
|
|
if (!game) return null;
|
|
|
|
return { id: gameKey, ...game, download };
|
|
};
|
|
|
|
registerEvent("getGameByObjectId", getGameByObjectId);
|