Download apps/desktop/src/single-instance.ts from SaylorTwift/deepseek-harness: direct link, hf CLI and curl.
- Browser
- Download file 929 Bytes
-
https://huggingface.co/SaylorTwift/deepseek-harness/resolve/main/apps/desktop/src/single-instance.ts
- Command line
-
hf download hf://SaylorTwift/deepseek-harness/apps/desktop/src/single-instance.ts
-
curl -L -o single-instance.ts https://huggingface.co/SaylorTwift/deepseek-harness/resolve/main/apps/desktop/src/single-instance.ts
929 Bytes
| /** Electron single-instance ownership before any Desktop profile lifecycle begins. */ | |
| /** Minimal Electron application operations needed for instance ownership. */ | |
| export interface DesktopSingleInstanceApplication { | |
| requestSingleInstanceLock(): boolean | |
| quit(): void | |
| on(event: 'second-instance', listener: () => void): unknown | |
| } | |
| /** | |
| * Claim the process-lifetime Desktop lock and route later launches to the owner. | |
| * @param application - Electron application singleton. | |
| * @param focusOwner - focus or recreate the primary window after a later launch. | |
| * @returns true only in the process that may access the Desktop profile. | |
| */ | |
| export function claimDesktopSingleInstance( | |
| application: DesktopSingleInstanceApplication, | |
| focusOwner: () => void, | |
| ): boolean { | |
| if (!application.requestSingleInstanceLock()) { | |
| application.quit() | |
| return false | |
| } | |
| application.on('second-instance', focusOwner) | |
| return true | |
| } | |