-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddWindow.html
31 lines (28 loc) · 917 Bytes
/
addWindow.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Add Shopping List Item</title>
</head>
<body>
<form>
<div>
<label>Enter Item</label>
<input type="text" id="item" autofocus>
</div>
<button type="submit">Add Item</button>
</form>
<script>
const electron = require('electron');
const {ipcRenderer} = electron;
const form = document.querySelector('form');
form.addEventListener('submit', submitForm);
function submitForm(e) {
// Prevent from trying to submit to a file
e.preventDefault();
const item = document.querySelector('#item').value;
// Sends the data to main.js basically
ipcRenderer.send('item:add', item);
}
</script>
</body>
</html>