mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-18 08:43:57 +00:00
feat: refactor achievement listeners
This commit is contained in:
@@ -14,6 +14,7 @@ import type {
|
||||
} from "@types";
|
||||
import type { CatalogueCategory } from "@shared";
|
||||
import type { AxiosProgressEvent } from "axios";
|
||||
import { GameAchievement } from "@main/entity";
|
||||
|
||||
contextBridge.exposeInMainWorld("electron", {
|
||||
/* Torrenting */
|
||||
@@ -69,6 +70,22 @@ contextBridge.exposeInMainWorld("electron", {
|
||||
return () =>
|
||||
ipcRenderer.removeListener("on-achievement-unlocked", listener);
|
||||
},
|
||||
onUpdateAchievements: (
|
||||
objectId: string,
|
||||
shop: GameShop,
|
||||
cb: (achievements: GameAchievement[]) => void
|
||||
) => {
|
||||
const listener = (
|
||||
_event: Electron.IpcRendererEvent,
|
||||
achievements: GameAchievement[]
|
||||
) => cb(achievements);
|
||||
ipcRenderer.on(`on-update-achievements-${objectId}-${shop}`, listener);
|
||||
return () =>
|
||||
ipcRenderer.removeListener(
|
||||
`on-update-achievements-${objectId}-${shop}`,
|
||||
listener
|
||||
);
|
||||
},
|
||||
|
||||
/* User preferences */
|
||||
getUserPreferences: () => ipcRenderer.invoke("getUserPreferences"),
|
||||
|
||||
Reference in New Issue
Block a user