mono/packages/kbot/gui/app/plugins/process/guest-js/index.ts
2025-09-14 20:17:38 +02:00

46 lines
1.0 KiB
TypeScript

// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
/**
* Perform operations on the current process.
* @module
*/
import { invoke } from '@tauri-apps/api/core'
/**
* Exits immediately with the given `exitCode`.
* @example
* ```typescript
* import { exit } from '@tauri-apps/plugin-process';
* await exit(1);
* ```
*
* @param code The exit code to use.
* @returns A promise indicating the success or failure of the operation.
*
* @since 2.0.0
*/
async function exit(code = 0): Promise<void> {
await invoke('plugin:process|exit', { code })
}
/**
* Exits the current instance of the app then relaunches it.
* @example
* ```typescript
* import { relaunch } from '@tauri-apps/plugin-process';
* await relaunch();
* ```
*
* @returns A promise indicating the success or failure of the operation.
*
* @since 2.0.0
*/
async function relaunch(): Promise<void> {
await invoke('plugin:process|restart')
}
export { exit, relaunch }