mirror of
https://github.com/tauri-apps/tauri-plugin-process.git
synced 2026-01-31 00:55:17 +01:00
* chore(deps): replace dependency eslint-config-standard-with-typescript with eslint-config-love 43.1.0 * actually apply the rules lol * rebuild --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: FabianLars <fabianlars@fabianlars.de> Committed via a GitHub action: https://github.com/tauri-apps/plugins-workspace/actions/runs/8791882915 Co-authored-by: FabianLars <FabianLars@users.noreply.github.com>
46 lines
1.0 KiB
JavaScript
46 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
var core = require('@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 core.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 core.invoke("plugin:process|restart");
|
|
}
|
|
|
|
exports.exit = exit;
|
|
exports.relaunch = relaunch;
|