A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.
TypeScript amazon-primeelectronepic-games-launcherepic-games-storeepic-storegaminggoggog-galaxyheroic-games-launcherlinuxplay-gamesprotonsteamwine
import { create } from 'zustand'
import { useShallow } from 'zustand/react/shallow'
import type { InstallProgress, Runner } from 'common/types'
type StoreType = Record<`${string}_${Runner}`, InstallProgress>
const useInstallProgressRaw = create<StoreType>()(() => ({}))
window.api.onProgressUpdate((e, { appName, progress, runner }) => {
const key = `${appName}_${runner}`
useInstallProgressRaw.setState({ [key]: progress })
})
export const useInstallProgress = <T>(
selector: Parameters<typeof useShallow<StoreType, T>>[0]
) => useInstallProgressRaw(useShallow(selector))