feat: expose app exit via JS process API#14767
Conversation
|
anyway, i'm not opposed to an exit js command but it should be part of the |
|
cc @whoever-in-the-working-group-cares anyone against having app.exit in js? Then the process plugin can be just for "other" processes than the current one (or both i guess) |
Package Changes Through c514b55There are 8 changes which include tauri-utils with patch, tauri-build with patch, tauri-cli with patch, @tauri-apps/cli with patch, tauri-runtime-wry with patch, tauri with minor, @tauri-apps/api with minor, tauri-runtime with patch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
Legend-Master
left a comment
There was a problem hiding this comment.
cc @whoever-in-the-working-group-cares anyone against having app.exit in js? Then the process plugin can be just for "other" processes than the current one (or both i guess)
Moving exit to core (app) makes a lot of sense to me at least
| * @since 2.10.0 | ||
| */ | ||
| async function exit(exitCode?: number): Promise<void> { | ||
| const payload = exitCode === undefined ? {} : { exitCode } |
There was a problem hiding this comment.
I think we could put the default value in the js side? (e.g. { exitCode: exitCode ?? 0 })
| * | ||
| * @since 2.10.0 | ||
| */ | ||
| async function exit(exitCode?: number): Promise<void> { |
There was a problem hiding this comment.
Let's move this to app (packages/api/src/app.ts)
It makes total sense, and actually it's unclear why the |
|
the process plugin was supposed to become more than that, more similar to nodejs' process module |
|
|
||
| #[command(root = "crate")] | ||
| pub fn exit<R: Runtime>(app: AppHandle<R>, exit_code: Option<i32>) { | ||
| app.exit(exit_code.unwrap_or(0)); |
There was a problem hiding this comment.
on Android this should route to the AppPlugin for graceful shutdown
Issue: #14714
Summary:
Motivation:
Validation: