Worked on update dialog
This commit is contained in:
parent
6b497d30cd
commit
fb7c632c2c
@ -11,7 +11,7 @@ edition = "2021"
|
|||||||
tauri-build = { version = "1", features = [] }
|
tauri-build = { version = "1", features = [] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tauri = { version = "1", features = ["shell-open"] }
|
tauri = { version = "1", features = [ "dialog-ask", "shell-open"] }
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
suppaftp = { version = "6.0.1", features = ["native-tls"] }
|
suppaftp = { version = "6.0.1", features = ["native-tls"] }
|
||||||
|
@ -14,6 +14,10 @@
|
|||||||
"shell": {
|
"shell": {
|
||||||
"all": false,
|
"all": false,
|
||||||
"open": true
|
"open": true
|
||||||
|
},
|
||||||
|
"dialog": {
|
||||||
|
"all": false,
|
||||||
|
"ask": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"windows": [
|
"windows": [
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const { invoke } = window.__TAURI__.tauri;
|
const { invoke } = window.__TAURI__.tauri;
|
||||||
const { listen } = window.__TAURI__.event;
|
const { listen } = window.__TAURI__.event;
|
||||||
|
const { ask } = window.__TAURI__.dialog;
|
||||||
//import { listen } from '@tauri-apps/api';
|
//import { listen } from '@tauri-apps/api';
|
||||||
|
|
||||||
let greetInputEl;
|
let greetInputEl;
|
||||||
@ -20,6 +21,10 @@ const download_finished = listen("download_finished", (event) => {
|
|||||||
document.getElementById("launchGame").disabled = false;
|
document.getElementById("launchGame").disabled = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const update_dialog = listen("update_dialog", (event) => {
|
||||||
|
ask("Do you want to update?", {title: "Update Available", type: "Message"}).then((value) => { if (value) { invoke("update").then(window.close()); } });
|
||||||
|
});
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
|
|
||||||
document.getElementById("launchGame").addEventListener("click", gameLaunch);
|
document.getElementById("launchGame").addEventListener("click", gameLaunch);
|
||||||
@ -57,6 +62,7 @@ function addModpacks(modpacks) {
|
|||||||
dropdown.options.add(opt);
|
dropdown.options.add(opt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function gameLaunch() {
|
function gameLaunch() {
|
||||||
var packId = document.getElementById("Modpacks");
|
var packId = document.getElementById("Modpacks");
|
||||||
var selectedId = packId.value;
|
var selectedId = packId.value;
|
||||||
|
Loading…
Reference in New Issue
Block a user