mirror of
https://github.com/tauri-apps/tauri-plugin-process.git
synced 2026-01-31 00:55:17 +01:00
* chore: adjust prettier config, .gitignore and use taplo to format toml files This brings the plugins-workspace repository to the same code style of the main tauri repo * format toml * ignore examples gen dir * add .vscode/extensions.json * remove packageManager field * fmt * fix audit * taplo ignore permissions autogenerated files * remove create dummy dist * fix prettier workflow * install fmt in prettier workflow --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app> Committed via a GitHub action: https://github.com/tauri-apps/plugins-workspace/actions/runs/10701104849 Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
43 lines
1018 B
JavaScript
43 lines
1018 B
JavaScript
import { invoke } from '@tauri-apps/api/core';
|
|
|
|
// 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
|
|
*/
|
|
/**
|
|
* 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) {
|
|
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() {
|
|
await invoke('plugin:process|restart');
|
|
}
|
|
|
|
export { exit, relaunch };
|