返回 DeepSeek-Reasonix
remoteNavigationCommands.ts
根目录 / desktop / frontend / src / lib / remoteNavigationCommands.ts
1 import { createContext, useContext } from "react";
2 import type { CommandOutcome } from "./commandOutcome";
3 import type { RemoteTabOpenOptions, RemoteTabRefView, TabMeta } from "./types";
4
5 /** Command-only dependency; no App snapshot or service lookup lives here. */
6 export type RemoteNavigationCommand = (remote: RemoteTabRefView, options: RemoteTabOpenOptions) => Promise<CommandOutcome<TabMeta | undefined>>;
7 const notReady: RemoteNavigationCommand = async () => ({ status: "cancelled", reason: "not-ready" });
8 export const RemoteNavigationContext = createContext<RemoteNavigationCommand>(notReady);
9 export function useRemoteNavigationCommand(): RemoteNavigationCommand { return useContext(RemoteNavigationContext); }
10
10 lines TYPESCRIPT