mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
refactor(core): move process endpoints to plugins-workspace (#6905)
This commit is contained in:
committed by
GitHub
parent
c4171152c1
commit
60cf9ed2fc
@@ -15,7 +15,6 @@
|
||||
|
||||
import * as event from './event'
|
||||
import * as path from './path'
|
||||
import * as process from './process'
|
||||
import * as tauri from './tauri'
|
||||
import * as updater from './updater'
|
||||
import * as window from './window'
|
||||
@@ -23,4 +22,4 @@ import * as window from './window'
|
||||
/** @ignore */
|
||||
const invoke = tauri.invoke
|
||||
|
||||
export { invoke, event, path, process, tauri, updater, window }
|
||||
export { invoke, event, path, tauri, updater, window }
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
// 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.
|
||||
*
|
||||
* This package is also accessible with `window.__TAURI__.process` when [`build.withGlobalTauri`](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in `tauri.conf.json` is set to `true`.
|
||||
* @module
|
||||
*/
|
||||
|
||||
import { invokeTauriCommand } from './helpers/tauri'
|
||||
|
||||
/**
|
||||
* Exits immediately with the given `exitCode`.
|
||||
* @example
|
||||
* ```typescript
|
||||
* import { exit } from '@tauri-apps/api/process';
|
||||
* await exit(1);
|
||||
* ```
|
||||
*
|
||||
* @param exitCode The exit code to use.
|
||||
* @returns A promise indicating the success or failure of the operation.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
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.
|
||||
* @example
|
||||
* ```typescript
|
||||
* import { relaunch } from '@tauri-apps/api/process';
|
||||
* await relaunch();
|
||||
* ```
|
||||
*
|
||||
* @returns A promise indicating the success or failure of the operation.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
async function relaunch(): Promise<void> {
|
||||
return invokeTauriCommand({
|
||||
__tauriModule: 'Process',
|
||||
message: {
|
||||
cmd: 'relaunch'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export { exit, relaunch }
|
||||
Reference in New Issue
Block a user