-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
41 lines (39 loc) · 1.11 KB
/
index.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
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello World!</title>
<style>
button {
margin-left: 100px;
}
</style>
</head>
<body>
<h1 style="color: red">Todos</h1>
<button type="button">Todos panel</button>
<ul></ul>
<script>
document.addEventListener('DOMContentLoaded', () => {
const btn = document.querySelector('button');
const { ipcRenderer } = require('electron');
btn.addEventListener('click', () => {
ipcRenderer.send('todo:open');
});
ipcRenderer.on('todos:show', (e, todos) => {
const ul = document.querySelector('ul');
ul.innerHTML = '';
todos.map((todo) => {
const li = document.createElement('li');
const text = document.createTextNode(todo.name);
const button = document.createElement('button');
button.innerHTML = 'Delete ME'; // Insert text
li.appendChild(text);
li.appendChild(button);
ul.appendChild(li);
});
});
});
</script>
</body>
</html>