mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-01-31 00:35:19 +01:00
fix(benchmarks): pure virtual method called (#2377)
* remove bench test lock Signed-off-by: David Lemarier <david@lemarier.ca> * use tauri commands to close the app Signed-off-by: David Lemarier <david@lemarier.ca>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -79,6 +79,7 @@ target
|
||||
|
||||
# lock for libs
|
||||
/Cargo.lock
|
||||
/tooling/bench/tests/Cargo.lock
|
||||
/yarn.lock
|
||||
|
||||
/tooling/cli.js/test/jest/tmp
|
||||
|
||||
@@ -202,6 +202,7 @@ fn run_exec_time(target_dir: &Path) -> Result<HashMap<String, HashMap<String, f6
|
||||
"hyperfine",
|
||||
"--export-json",
|
||||
benchmark_file,
|
||||
"--show-output",
|
||||
"--warmup",
|
||||
"3",
|
||||
]
|
||||
|
||||
3001
tooling/bench/tests/Cargo.lock
generated
3001
tooling/bench/tests/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -17,13 +17,7 @@ const onMessage = (message) => {
|
||||
|
||||
if (message.data.status === 'done') {
|
||||
// tell tauri that we are done
|
||||
window.__TAURI__.invoke('tauri', {
|
||||
__tauriModule: 'Process',
|
||||
message: {
|
||||
cmd: 'exit',
|
||||
exitCode: 0
|
||||
}
|
||||
})
|
||||
window.__TAURI__.invoke('app_completed_successfully');
|
||||
}
|
||||
|
||||
status.innerHTML = `${prefix} Found <code>${message.data.count}</code> prime numbers in <code>${message.data.time}ms</code>`
|
||||
|
||||
@@ -7,8 +7,14 @@
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
#[tauri::command]
|
||||
fn app_completed_successfully() {
|
||||
std::process::exit(0);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![app_completed_successfully])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
@@ -24,23 +24,12 @@
|
||||
}
|
||||
})
|
||||
.then((_data) => {
|
||||
window.__TAURI__.invoke('tauri', {
|
||||
__tauriModule: 'Process',
|
||||
message: {
|
||||
cmd: 'exit',
|
||||
exitCode: 0
|
||||
}
|
||||
})
|
||||
// success
|
||||
window.__TAURI__.invoke('app_should_close', {exitCode: 0});
|
||||
})
|
||||
.catch((_error) => {
|
||||
// error
|
||||
window.__TAURI__.invoke('tauri', {
|
||||
__tauriModule: 'Process',
|
||||
message: {
|
||||
cmd: 'exit',
|
||||
exitCode: 1
|
||||
}
|
||||
})
|
||||
window.__TAURI__.invoke('app_should_close', {exitCode: 1});
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -7,8 +7,14 @@
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
#[tauri::command]
|
||||
fn app_should_close(exit_code: i32) {
|
||||
std::process::exit(exit_code);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![app_should_close])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
@@ -10,15 +10,8 @@
|
||||
<h1>Welcome to Tauri!</h1>
|
||||
|
||||
<script>
|
||||
window.addEventListener('DOMContentLoaded', (event) => {
|
||||
window.__TAURI__.invoke('tauri', {
|
||||
__tauriModule: 'Process',
|
||||
message: {
|
||||
cmd: 'exit',
|
||||
exitCode: 0
|
||||
}
|
||||
})
|
||||
})
|
||||
window.addEventListener('DOMContentLoaded', (event) =>
|
||||
window.__TAURI__.invoke('app_loaded_successfully'));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,8 +7,14 @@
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
#[tauri::command]
|
||||
fn app_loaded_successfully() {
|
||||
std::process::exit(0);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![app_loaded_successfully])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user