···2233## Ben
4455-- [ ] Transport : Packet splitting
66-- [ ] State : Event history tracking
77-- [ ] State : Post game sync
88-- [ ] API : Handling Profile Syncing
99-- [ ] ALL : State Update Events
1010-- [ ] ALL : Game Replay Screen
1111-- [ ] Frontend : Scaffolding
1212-- [ ] Meta : CI Setup
1313-- [ ] Meta : README Instructions
1414-- [x] Meta : Recipes for type binding generation
55+- [ ] Transport : Packet splitting
66+- [ ] State : Event history tracking
77+- [ ] State : Post game sync
88+- [ ] API : Handling Profile Syncing
99+- [ ] ALL : State Update Events
1010+- [ ] ALL : Game Replay Screen
1111+- [ ] Frontend : Scaffolding
1212+- [ ] Meta : CI Setup
1313+- [ ] Meta : README Instructions
1414+- [x] Meta : Recipes for type binding generation
+4-4
backend/src/export_types.rs
···11-use std::path::PathBuf;
11+use std::{borrow::Cow, path::PathBuf};
2233use manhunt_app_lib::mk_specta;
44use specta_typescript::Typescript;
···1010 .canonicalize()
1111 .expect("Failed to canonicalize path");
1212 let specta = mk_specta();
1313- specta
1414- .export(Typescript::default(), &path)
1515- .expect("Failed to export types");
1313+ let mut lang = Typescript::new();
1414+ lang.header = Cow::Borrowed("/* eslint @typescript-eslint/no-unused-vars: 0 */\n/* eslint @typescript-eslint/no-explicit-any: 0 */");
1515+ specta.export(lang, &path).expect("Failed to export types");
1616 println!(
1717 "Successfully exported type and commands to {}",
1818 path.to_str().unwrap()
···11-11+/* eslint @typescript-eslint/no-unused-vars: 0 */
22+/* eslint @typescript-eslint/no-explicit-any: 0 */
23// This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually.
3445/** user-defined commands **/
5666-77export const commands = {
88-/**
99- * (Screen: Menu) Start/Join a new lobby, set `join_code` to `null` to be host,
1010- * set it to a join code to be a client. This triggers a screen change to [AppScreen::Lobby]
1111- */
1212-async startLobby(joinCode: string | null, settings: GameSettings) : Promise<Result<null, string>> {
1313- try {
1414- return { status: "ok", data: await TAURI_INVOKE("start_lobby", { joinCode, settings }) };
1515-} catch (e) {
1616- if(e instanceof Error) throw e;
1717- else return { status: "error", error: e as any };
1818-}
1919-},
2020-/**
2121- * Quit a running game or leave a lobby
2222- */
2323-async quitGameOrLobby() : Promise<Result<null, string>> {
2424- try {
2525- return { status: "ok", data: await TAURI_INVOKE("quit_game_or_lobby") };
2626-} catch (e) {
2727- if(e instanceof Error) throw e;
2828- else return { status: "error", error: e as any };
2929-}
3030-},
3131-/**
3232- * Get the screen the app should currently be on, returns [AppScreen]
3333- */
3434-async getCurrentScreen() : Promise<Result<AppScreen, string>> {
3535- try {
3636- return { status: "ok", data: await TAURI_INVOKE("get_current_screen") };
3737-} catch (e) {
3838- if(e instanceof Error) throw e;
3939- else return { status: "error", error: e as any };
4040-}
4141-},
4242-/**
4343- * (Screen: Menu) Update the player's profile and persist it
4444- */
4545-async updateProfile(newProfile: PlayerProfile) : Promise<Result<null, string>> {
4646- try {
4747- return { status: "ok", data: await TAURI_INVOKE("update_profile", { newProfile }) };
4848-} catch (e) {
4949- if(e instanceof Error) throw e;
5050- else return { status: "error", error: e as any };
5151-}
5252-},
5353-/**
5454- * (Screen: Lobby) Get the current state of the lobby, call after receiving an update event
5555- */
5656-async getLobbyState() : Promise<Result<LobbyState, string>> {
5757- try {
5858- return { status: "ok", data: await TAURI_INVOKE("get_lobby_state") };
5959-} catch (e) {
6060- if(e instanceof Error) throw e;
6161- else return { status: "error", error: e as any };
6262-}
6363-},
6464-/**
6565- * (Screen: Lobby) HOST ONLY: Push new settings to everyone, does nothing on clients. Returns the
6666- * new lobby state
6767- */
6868-async hostUpdateSettings(settings: GameSettings) : Promise<Result<LobbyState, string>> {
6969- try {
7070- return { status: "ok", data: await TAURI_INVOKE("host_update_settings", { settings }) };
7171-} catch (e) {
7272- if(e instanceof Error) throw e;
7373- else return { status: "error", error: e as any };
7474-}
7575-},
7676-/**
7777- * (Screen: Lobby) Switch teams between seekers and hiders, returns the new [LobbyState]
7878- */
7979-async switchTeams(seeker: boolean) : Promise<Result<LobbyState, string>> {
8080- try {
8181- return { status: "ok", data: await TAURI_INVOKE("switch_teams", { seeker }) };
8282-} catch (e) {
8383- if(e instanceof Error) throw e;
8484- else return { status: "error", error: e as any };
8585-}
8686-},
8787-/**
8888- * (Screen: Lobby) HOST ONLY: Start the game, stops anyone else from joining and switched screen
8989- * to AppScreen::Game.
9090- */
9191-async hostStartGame() : Promise<Result<null, string>> {
9292- try {
9393- return { status: "ok", data: await TAURI_INVOKE("host_start_game") };
9494-} catch (e) {
9595- if(e instanceof Error) throw e;
9696- else return { status: "error", error: e as any };
9797-}
9898-},
9999-/**
100100- * (Screen: Game) Mark this player as caught, this player will become a seeker. Returns the new game state
101101- */
102102-async markCaught() : Promise<Result<GameState, string>> {
103103- try {
104104- return { status: "ok", data: await TAURI_INVOKE("mark_caught") };
105105-} catch (e) {
106106- if(e instanceof Error) throw e;
107107- else return { status: "error", error: e as any };
108108-}
109109-},
110110-/**
111111- * (Screen: Game) Grab a powerup on the map, this should be called when the user is *in range* of
112112- * the powerup. Returns the new game state after rolling for the powerup
113113- */
114114-async grabPowerup() : Promise<Result<GameState, string>> {
115115- try {
116116- return { status: "ok", data: await TAURI_INVOKE("grab_powerup") };
117117-} catch (e) {
118118- if(e instanceof Error) throw e;
119119- else return { status: "error", error: e as any };
120120-}
121121-},
122122-/**
123123- * (Screen: Game) Use the currently held powerup in the player's held_powerup. Does nothing if the
124124- * player has none. Returns the updated game state
125125- */
126126-async usePowerup() : Promise<Result<GameState, string>> {
127127- try {
128128- return { status: "ok", data: await TAURI_INVOKE("use_powerup") };
129129-} catch (e) {
130130- if(e instanceof Error) throw e;
131131- else return { status: "error", error: e as any };
132132-}
133133-}
134134-}
88+ /**
99+ * (Screen: Menu) Start/Join a new lobby, set `join_code` to `null` to be host,
1010+ * set it to a join code to be a client. This triggers a screen change to [AppScreen::Lobby]
1111+ */
1212+ async startLobby(
1313+ joinCode: string | null,
1414+ settings: GameSettings
1515+ ): Promise<Result<null, string>> {
1616+ try {
1717+ return {
1818+ status: "ok",
1919+ data: await TAURI_INVOKE("start_lobby", { joinCode, settings })
2020+ };
2121+ } catch (e) {
2222+ if (e instanceof Error) throw e;
2323+ else return { status: "error", error: e as any };
2424+ }
2525+ },
2626+ /**
2727+ * Quit a running game or leave a lobby
2828+ */
2929+ async quitGameOrLobby(): Promise<Result<null, string>> {
3030+ try {
3131+ return { status: "ok", data: await TAURI_INVOKE("quit_game_or_lobby") };
3232+ } catch (e) {
3333+ if (e instanceof Error) throw e;
3434+ else return { status: "error", error: e as any };
3535+ }
3636+ },
3737+ /**
3838+ * Get the screen the app should currently be on, returns [AppScreen]
3939+ */
4040+ async getCurrentScreen(): Promise<Result<AppScreen, string>> {
4141+ try {
4242+ return { status: "ok", data: await TAURI_INVOKE("get_current_screen") };
4343+ } catch (e) {
4444+ if (e instanceof Error) throw e;
4545+ else return { status: "error", error: e as any };
4646+ }
4747+ },
4848+ /**
4949+ * (Screen: Menu) Update the player's profile and persist it
5050+ */
5151+ async updateProfile(newProfile: PlayerProfile): Promise<Result<null, string>> {
5252+ try {
5353+ return { status: "ok", data: await TAURI_INVOKE("update_profile", { newProfile }) };
5454+ } catch (e) {
5555+ if (e instanceof Error) throw e;
5656+ else return { status: "error", error: e as any };
5757+ }
5858+ },
5959+ /**
6060+ * (Screen: Lobby) Get the current state of the lobby, call after receiving an update event
6161+ */
6262+ async getLobbyState(): Promise<Result<LobbyState, string>> {
6363+ try {
6464+ return { status: "ok", data: await TAURI_INVOKE("get_lobby_state") };
6565+ } catch (e) {
6666+ if (e instanceof Error) throw e;
6767+ else return { status: "error", error: e as any };
6868+ }
6969+ },
7070+ /**
7171+ * (Screen: Lobby) HOST ONLY: Push new settings to everyone, does nothing on clients. Returns the
7272+ * new lobby state
7373+ */
7474+ async hostUpdateSettings(settings: GameSettings): Promise<Result<LobbyState, string>> {
7575+ try {
7676+ return { status: "ok", data: await TAURI_INVOKE("host_update_settings", { settings }) };
7777+ } catch (e) {
7878+ if (e instanceof Error) throw e;
7979+ else return { status: "error", error: e as any };
8080+ }
8181+ },
8282+ /**
8383+ * (Screen: Lobby) Switch teams between seekers and hiders, returns the new [LobbyState]
8484+ */
8585+ async switchTeams(seeker: boolean): Promise<Result<LobbyState, string>> {
8686+ try {
8787+ return { status: "ok", data: await TAURI_INVOKE("switch_teams", { seeker }) };
8888+ } catch (e) {
8989+ if (e instanceof Error) throw e;
9090+ else return { status: "error", error: e as any };
9191+ }
9292+ },
9393+ /**
9494+ * (Screen: Lobby) HOST ONLY: Start the game, stops anyone else from joining and switched screen
9595+ * to AppScreen::Game.
9696+ */
9797+ async hostStartGame(): Promise<Result<null, string>> {
9898+ try {
9999+ return { status: "ok", data: await TAURI_INVOKE("host_start_game") };
100100+ } catch (e) {
101101+ if (e instanceof Error) throw e;
102102+ else return { status: "error", error: e as any };
103103+ }
104104+ },
105105+ /**
106106+ * (Screen: Game) Mark this player as caught, this player will become a seeker. Returns the new game state
107107+ */
108108+ async markCaught(): Promise<Result<GameState, string>> {
109109+ try {
110110+ return { status: "ok", data: await TAURI_INVOKE("mark_caught") };
111111+ } catch (e) {
112112+ if (e instanceof Error) throw e;
113113+ else return { status: "error", error: e as any };
114114+ }
115115+ },
116116+ /**
117117+ * (Screen: Game) Grab a powerup on the map, this should be called when the user is *in range* of
118118+ * the powerup. Returns the new game state after rolling for the powerup
119119+ */
120120+ async grabPowerup(): Promise<Result<GameState, string>> {
121121+ try {
122122+ return { status: "ok", data: await TAURI_INVOKE("grab_powerup") };
123123+ } catch (e) {
124124+ if (e instanceof Error) throw e;
125125+ else return { status: "error", error: e as any };
126126+ }
127127+ },
128128+ /**
129129+ * (Screen: Game) Use the currently held powerup in the player's held_powerup. Does nothing if the
130130+ * player has none. Returns the updated game state
131131+ */
132132+ async usePowerup(): Promise<Result<GameState, string>> {
133133+ try {
134134+ return { status: "ok", data: await TAURI_INVOKE("use_powerup") };
135135+ } catch (e) {
136136+ if (e instanceof Error) throw e;
137137+ else return { status: "error", error: e as any };
138138+ }
139139+ }
140140+};
135141136142/** user-defined events **/
137143138138-139139-140144/** user-defined constants **/
141145142142-143143-144146/** user-defined types **/
145147146146-export type AppScreen = "Setup" | "Menu" | "Lobby" | "Game"
148148+export type AppScreen = "Setup" | "Menu" | "Lobby" | "Game";
147149/**
148150 * Settings for the game, host is the only person able to change these
149151 */
150150-export type GameSettings = {
151151-/**
152152- * The random seed used for shared rng
153153- */
154154-random_seed: number;
155155-/**
156156- * The number of seconds to wait before seekers are allowed to go
157157- */
158158-hiding_time_seconds: number;
159159-/**
160160- * Condition to wait for global pings to begin
161161- */
162162-ping_start: PingStartCondition;
163163-/**
164164- * Time between pings after the condition is met (first ping is either after the interval or
165165- * instantly after the condition is met depending on the condition)
166166- */
167167-ping_minutes_interval: number;
168168-/**
169169- * Condition for powerups to start spawning
170170- */
171171-powerup_start: PingStartCondition;
172172-/**
173173- * Chance every minute of a powerup spawning, out of 100
174174- */
175175-powerup_chance: number;
176176-/**
177177- * Hard cooldown between powerups spawning
178178- */
179179-powerup_minutes_cooldown: number;
180180-/**
181181- * Locations that powerups may spawn at
182182- */
183183-powerup_locations: Location[] }
152152+export type GameSettings = {
153153+ /**
154154+ * The random seed used for shared rng
155155+ */
156156+ random_seed: number;
157157+ /**
158158+ * The number of seconds to wait before seekers are allowed to go
159159+ */
160160+ hiding_time_seconds: number;
161161+ /**
162162+ * Condition to wait for global pings to begin
163163+ */
164164+ ping_start: PingStartCondition;
165165+ /**
166166+ * Time between pings after the condition is met (first ping is either after the interval or
167167+ * instantly after the condition is met depending on the condition)
168168+ */
169169+ ping_minutes_interval: number;
170170+ /**
171171+ * Condition for powerups to start spawning
172172+ */
173173+ powerup_start: PingStartCondition;
174174+ /**
175175+ * Chance every minute of a powerup spawning, out of 100
176176+ */
177177+ powerup_chance: number;
178178+ /**
179179+ * Hard cooldown between powerups spawning
180180+ */
181181+ powerup_minutes_cooldown: number;
182182+ /**
183183+ * Locations that powerups may spawn at
184184+ */
185185+ powerup_locations: Location[];
186186+};
184187/**
185188 * This struct handles all logic regarding state updates
186189 */
187187-export type GameState = {
188188-/**
189189- * The id of this player in this game
190190- */
191191-id: string;
192192-/**
193193- * The powerup the player is currently holding
194194- */
195195-held_powerup: PowerUpType | null;
196196-/**
197197- * When the game started
198198- */
199199-game_started: string;
200200-/**
201201- * When seekers were allowed to begin
202202- */
203203-seekers_started: string | null;
204204-/**
205205- * Last time we pinged all players
206206- */
207207-last_global_ping: string | null;
208208-/**
209209- * Last time a powerup was spawned
210210- */
211211-last_powerup_spawn: string | null;
212212-/**
213213- * Hashmap tracking if a player is a seeker (true) or a hider (false)
214214- */
215215-caught_state: Partial<{ [key in string]: boolean }>;
216216-/**
217217- * A map of the latest global ping results for each player
218218- */
219219-pings: Partial<{ [key in string]: PlayerPing }>;
220220-/**
221221- * Powerup on the map that players can grab. Only one at a time
222222- */
223223-available_powerup: Location | null }
224224-export type LobbyState = { profiles: Partial<{ [key in string]: PlayerProfile }>; join_code: string;
225225-/**
226226- * True represents seeker, false hider
227227- */
228228-teams: Partial<{ [key in string]: boolean }>; self_seeker: boolean; settings: GameSettings }
190190+export type GameState = {
191191+ /**
192192+ * The id of this player in this game
193193+ */
194194+ id: string;
195195+ /**
196196+ * The powerup the player is currently holding
197197+ */
198198+ held_powerup: PowerUpType | null;
199199+ /**
200200+ * When the game started
201201+ */
202202+ game_started: string;
203203+ /**
204204+ * When seekers were allowed to begin
205205+ */
206206+ seekers_started: string | null;
207207+ /**
208208+ * Last time we pinged all players
209209+ */
210210+ last_global_ping: string | null;
211211+ /**
212212+ * Last time a powerup was spawned
213213+ */
214214+ last_powerup_spawn: string | null;
215215+ /**
216216+ * Hashmap tracking if a player is a seeker (true) or a hider (false)
217217+ */
218218+ caught_state: Partial<{ [key in string]: boolean }>;
219219+ /**
220220+ * A map of the latest global ping results for each player
221221+ */
222222+ pings: Partial<{ [key in string]: PlayerPing }>;
223223+ /**
224224+ * Powerup on the map that players can grab. Only one at a time
225225+ */
226226+ available_powerup: Location | null;
227227+};
228228+export type LobbyState = {
229229+ profiles: Partial<{ [key in string]: PlayerProfile }>;
230230+ join_code: string;
231231+ /**
232232+ * True represents seeker, false hider
233233+ */
234234+ teams: Partial<{ [key in string]: boolean }>;
235235+ self_seeker: boolean;
236236+ settings: GameSettings;
237237+};
229238/**
230239 * Some location in the world as gotten from a Geolocation API
231240 */
232232-export type Location = {
233233-/**
234234- * Latitude
235235- */
236236-lat: number;
237237-/**
238238- * Longitude
239239- */
240240-long: number;
241241-/**
242242- * The bearing (float normalized from 0 to 1) optional as GPS can't always determine
243243- */
244244-heading: number | null }
241241+export type Location = {
242242+ /**
243243+ * Latitude
244244+ */
245245+ lat: number;
246246+ /**
247247+ * Longitude
248248+ */
249249+ long: number;
250250+ /**
251251+ * The bearing (float normalized from 0 to 1) optional as GPS can't always determine
252252+ */
253253+ heading: number | null;
254254+};
245255/**
246256 * The starting condition for global pings to begin
247257 */
248248-export type PingStartCondition =
249249-/**
250250- * Wait For X players to be caught before beginning global pings
251251- */
252252-{ Players: number } |
253253-/**
254254- * Wait for X minutes after game start to begin global pings
255255- */
256256-{ Minutes: number } |
257257-/**
258258- * Don't wait at all, ping location after seekers are released
259259- */
260260-"Instant"
258258+export type PingStartCondition =
259259+ /**
260260+ * Wait For X players to be caught before beginning global pings
261261+ */
262262+ | { Players: number }
263263+ /**
264264+ * Wait for X minutes after game start to begin global pings
265265+ */
266266+ | { Minutes: number }
267267+ /**
268268+ * Don't wait at all, ping location after seekers are released
269269+ */
270270+ | "Instant";
261271/**
262272 * An on-map ping of a player
263273 */
264264-export type PlayerPing = {
265265-/**
266266- * Location of the ping
267267- */
268268-loc: Location;
269269-/**
270270- * Time the ping happened
271271- */
272272-timestamp: string;
273273-/**
274274- * The player to display as
275275- */
276276-display_player: string;
277277-/**
278278- * The actual player that initialized this ping
279279- */
280280-real_player: string }
281281-export type PlayerProfile = { display_name: string; pfp_base64: string | null }
274274+export type PlayerPing = {
275275+ /**
276276+ * Location of the ping
277277+ */
278278+ loc: Location;
279279+ /**
280280+ * Time the ping happened
281281+ */
282282+ timestamp: string;
283283+ /**
284284+ * The player to display as
285285+ */
286286+ display_player: string;
287287+ /**
288288+ * The actual player that initialized this ping
289289+ */
290290+ real_player: string;
291291+};
292292+export type PlayerProfile = { display_name: string; pfp_base64: string | null };
282293/**
283294 * Type of powerup
284295 */
285285-export type PowerUpType =
286286-/**
287287- * Ping a random seeker instead of a hider
288288- */
289289-"PingSeeker" |
290290-/**
291291- * Pings all seekers locations on the map for hiders
292292- */
293293-"PingAllSeekers" |
294294-/**
295295- * Ping another random hider instantly
296296- */
297297-"ForcePingOther"
296296+export type PowerUpType =
297297+ /**
298298+ * Ping a random seeker instead of a hider
299299+ */
300300+ | "PingSeeker"
301301+ /**
302302+ * Pings all seekers locations on the map for hiders
303303+ */
304304+ | "PingAllSeekers"
305305+ /**
306306+ * Ping another random hider instantly
307307+ */
308308+ | "ForcePingOther";
298309299310/** tauri-specta globals **/
300311301301-import {
302302- invoke as TAURI_INVOKE,
303303- Channel as TAURI_CHANNEL,
304304-} from "@tauri-apps/api/core";
312312+import { invoke as TAURI_INVOKE, Channel as TAURI_CHANNEL } from "@tauri-apps/api/core";
305313import * as TAURI_API_EVENT from "@tauri-apps/api/event";
306314import { type WebviewWindow as __WebviewWindow__ } from "@tauri-apps/api/webviewWindow";
307315308316type __EventObj__<T> = {
309309- listen: (
310310- cb: TAURI_API_EVENT.EventCallback<T>,
311311- ) => ReturnType<typeof TAURI_API_EVENT.listen<T>>;
312312- once: (
313313- cb: TAURI_API_EVENT.EventCallback<T>,
314314- ) => ReturnType<typeof TAURI_API_EVENT.once<T>>;
315315- emit: null extends T
316316- ? (payload?: T) => ReturnType<typeof TAURI_API_EVENT.emit>
317317- : (payload: T) => ReturnType<typeof TAURI_API_EVENT.emit>;
317317+ listen: (cb: TAURI_API_EVENT.EventCallback<T>) => ReturnType<typeof TAURI_API_EVENT.listen<T>>;
318318+ once: (cb: TAURI_API_EVENT.EventCallback<T>) => ReturnType<typeof TAURI_API_EVENT.once<T>>;
319319+ emit: null extends T
320320+ ? (payload?: T) => ReturnType<typeof TAURI_API_EVENT.emit>
321321+ : (payload: T) => ReturnType<typeof TAURI_API_EVENT.emit>;
318322};
319323320320-export type Result<T, E> =
321321- | { status: "ok"; data: T }
322322- | { status: "error"; error: E };
324324+export type Result<T, E> = { status: "ok"; data: T } | { status: "error"; error: E };
323325324324-function __makeEvents__<T extends Record<string, any>>(
325325- mappings: Record<keyof T, string>,
326326-) {
327327- return new Proxy(
328328- {} as unknown as {
329329- [K in keyof T]: __EventObj__<T[K]> & {
330330- (handle: __WebviewWindow__): __EventObj__<T[K]>;
331331- };
332332- },
333333- {
334334- get: (_, event) => {
335335- const name = mappings[event as keyof T];
326326+function __makeEvents__<T extends Record<string, any>>(mappings: Record<keyof T, string>) {
327327+ return new Proxy(
328328+ {} as unknown as {
329329+ [K in keyof T]: __EventObj__<T[K]> & {
330330+ (handle: __WebviewWindow__): __EventObj__<T[K]>;
331331+ };
332332+ },
333333+ {
334334+ get: (_, event) => {
335335+ const name = mappings[event as keyof T];
336336337337- return new Proxy((() => {}) as any, {
338338- apply: (_, __, [window]: [__WebviewWindow__]) => ({
339339- listen: (arg: any) => window.listen(name, arg),
340340- once: (arg: any) => window.once(name, arg),
341341- emit: (arg: any) => window.emit(name, arg),
342342- }),
343343- get: (_, command: keyof __EventObj__<any>) => {
344344- switch (command) {
345345- case "listen":
346346- return (arg: any) => TAURI_API_EVENT.listen(name, arg);
347347- case "once":
348348- return (arg: any) => TAURI_API_EVENT.once(name, arg);
349349- case "emit":
350350- return (arg: any) => TAURI_API_EVENT.emit(name, arg);
351351- }
352352- },
353353- });
354354- },
355355- },
356356- );
337337+ return new Proxy((() => {}) as any, {
338338+ apply: (_, __, [window]: [__WebviewWindow__]) => ({
339339+ listen: (arg: any) => window.listen(name, arg),
340340+ once: (arg: any) => window.once(name, arg),
341341+ emit: (arg: any) => window.emit(name, arg)
342342+ }),
343343+ get: (_, command: keyof __EventObj__<any>) => {
344344+ switch (command) {
345345+ case "listen":
346346+ return (arg: any) => TAURI_API_EVENT.listen(name, arg);
347347+ case "once":
348348+ return (arg: any) => TAURI_API_EVENT.once(name, arg);
349349+ case "emit":
350350+ return (arg: any) => TAURI_API_EVENT.emit(name, arg);
351351+ }
352352+ }
353353+ });
354354+ }
355355+ }
356356+ );
357357}