Files
archived-tauri-plugin-process/guest-js/index.ts
Lucas Fernandes Nogueira 56ce9dae00 chore: add remaining mirrors (#382)
Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>

Committed via a GitHub action: https://github.com/tauri-apps/plugins-workspace/actions/runs/5038084282

Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2023-05-21 14:09:27 +00: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/tauri";
/**
* 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 1.0.0
*/
async function exit(code = 0): Promise<void> {
return 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 1.0.0
*/
async function relaunch(): Promise<void> {
return invoke("plugin:process|restart");
}
export { exit, relaunch };