app
import { app } from "@tynd/core/client";App identity and lifecycle. Callable from both frontend and backend.
app.setInfo({ name, version })
Sets the app’s identity. Typically called once from the backend at startup using fields from package.json:
import pkg from "../package.json";
await app.setInfo({ name: pkg.name, version: pkg.version });Used by other APIs (notifications, tray tooltip, OS integration) to identify the app consistently.
app.getName(): Promise<string>
Returns the registered name. Falls back to the binary file stem if setInfo wasn’t called.
const name = await app.getName();app.getVersion(): Promise<string>
Returns the registered version. Falls back to "0.0.0".
const version = await app.getVersion();app.relaunch(): Promise<void>
Spawns a fresh copy of the current binary and exits the current process. Equivalent to user-initiated relaunch.
await app.relaunch();Useful after applying an update, toggling a runtime flag, or loading a new backend.
app.exit(code?: number): Promise<void>
Exits the app gracefully. The app.onClose hook runs (with its usual 2-second watchdog) before the process terminates.
await app.exit(0);Pass a non-zero code to signal an error to the invoking shell / installer. Default is 0.
Notes
app.exit(0)is preferable toprocess.exit(0)— the former runs lifecycle hooks, the latter doesn’t.- On Windows,
relaunchusescmd /c startso the current.exeunlocks before the new one runs. - On Linux,
relaunchre-exec’s via/proc/self/exe. - On macOS,
relaunchspawns viaNSWorkspace.openApplication.
Related
- Single Instance guide — argv forwarding.
- Updater —
install({ relaunch: true })usesapp.relaunchinternally.