Files
tauri/tooling/api/src/process.ts
Lucas Fernandes Nogueira f7892cf4ff feat(api): documentation (#1694)
* feat(api): documentation

* more docs [skip ci]
2021-05-05 14:36:40 -03:00

43 lines
958 B
TypeScript

// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
import { invokeTauriCommand } from './helpers/tauri'
/**
* Perform operations on the current process.
* @packageDocumentation
*/
/**
* Exits immediately with the given `exitCode`.
*
* @param exitCode The exit code to use.
* @returns A promise indicating the success or failure of the operation.
*/
async function exit(exitCode: number = 0): Promise<void> {
return invokeTauriCommand({
__tauriModule: 'Process',
message: {
cmd: 'exit',
exitCode
}
})
}
/**
* Exits the current instance of the app then relaunches it.
*
* @returns A promise indicating the success or failure of the operation.
*/
async function relaunch(): Promise<void> {
return invokeTauriCommand({
__tauriModule: 'Process',
message: {
cmd: 'relaunch'
}
})
}
export { exit, relaunch }