mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 06:10:44 +08:00
20 lines
557 B
TypeScript
20 lines
557 B
TypeScript
import type { UnlistenFn } from "@tauri-apps/api/event";
|
|
|
|
import { listen } from "@tauri-apps/api/event";
|
|
import once from "lodash/once";
|
|
|
|
import { nodeRunning } from "./events";
|
|
|
|
export let unlistenNodeEvents: UnlistenFn | undefined = undefined;
|
|
|
|
export function setUnlistenNodeEvents(unlisten: UnlistenFn) {
|
|
unlistenNodeEvents = unlisten;
|
|
}
|
|
|
|
// Will be called once in the startup of the app
|
|
export const createEventEmittersOnce = once(async () => {
|
|
return await listen<boolean>("node_running", event => {
|
|
nodeRunning.set(event.payload);
|
|
});
|
|
});
|