-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
31 lines (29 loc) · 1.11 KB
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const electron = require("electron");
const ipc = electron.ipcRenderer;
document
.getElementById("updateBtn")
.addEventListener("click", function (event) {
event.preventDefault();
let val = document.getElementById("fetchFeature").value;
if (document.getElementById("feature").value != "categorical") {
let min = Number(
document.getElementById("fetchFeature").getAttribute("min")
);
let max = Number(
document.getElementById("fetchFeature").getAttribute("max")
);
val = Number(val);
if (val > max || val < min) {
document.getElementById("updateBtn").classList.remove("btn-primary");
document.getElementById("updateBtn").classList.add("btn-danger");
document.getElementById("errMsg").innerHTML =
"Value must be between <b>" + min + "</b> and <b>" + max + "</b>";
} else {
let featureList = ipc.send("update-feature", val);
electron.remote.getCurrentWindow().close();
}
} else {
let featureList = ipc.send("update-feature", val);
electron.remote.getCurrentWindow().close();
}
});