aboutsummaryrefslogtreecommitdiff
path: root/src/app/js/process.js
blob: a4aba6c789ba8fae3b0a551d6d8d4a00c7f6721a (plain)
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
const ipcRenderer = require("electron").ipcRenderer;

ipcRenderer.on("log", (_, msg) => {
	console.log(msg)
})

ipcRenderer.on("alert", (_, data) => {
	alert(data.message);
	ipcRenderer.send("alert-closed-" + data.id);
})

ipcRenderer.on("confirm", (_, data) => {
	let confirmed = confirm(data.message);
	ipcRenderer.send("confirm-closed-" + data.id, confirmed);
})

module.exports = {
	// attempts to relaunch the process
	relaunch: () => {
		ipcRenderer.send("relaunch");
	},

	// attempts to exit the process (closing Viper)
	exit: () => {
		ipcRenderer.send("exit")
	}
}