-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.html
More file actions
44 lines (39 loc) · 1.1 KB
/
main.html
File metadata and controls
44 lines (39 loc) · 1.1 KB
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
42
43
44
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Hai</title>
<link rel="stylesheet" href="style.css">
<script src="particlesjs_master/particles.min.js"></script>
</head>
<body>
<div id="tulisan">
Hello Me
<ul></ul>
<h2></h2>
</div>
<div id="particles"></div>
</body>
<script src="configparticlejs.js"></script>
<script type="text/javascript">
const electron = require('electron');
const {ipcRenderer} = electron;
const ul = document.querySelector('ul');
//ambil data item:add dari index.js yang dikirim dari halaman1.html
ipcRenderer.on('item:add',(e, item) => {
const li = document.createElement('li');
const isiItem = document.createTextNode(item);
li.appendChild(isiItem);
ul.appendChild(li);
});
//clear semua yang ada di ul
ipcRenderer.on('item:clear',() => {
ul.innerHTML = '';
});
//hapus item jika di double click
ul.addEventListener('dblclick',hapusItem);
function hapusItem(e){
e.target.remove();
}
</script>
</html>