forked from electron/electron-quick-start
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
79 lines (75 loc) · 2.13 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<style>
body {
-webkit-app-region: drag;
cursor: default;
}
input, button {
-webkit-app-region: no-drag;
}
#mainBox {
font-family: sans-serif;
font-size: 14pt;
width: 90%;
}
</style>
</head>
<body onload="doLoad();">
<script>
var app = require('electron');
app.ipcRenderer.on('focused', function(event, message) {
console.log('Focused in renderer');
document.getElementById('mainBox').focus();
});
app.ipcRenderer.on('patientUpdated', function(event, patient) {
if(patient) {
val = patient.LastName + ', ' + patient.FirstName + ' ' + patient.MiddleName;
} else {
val = 'None';
}
document.getElementById('patient').innerText = val;
});
app.ipcRenderer.on('encounterUpdated', function(event, encounter) {
if(encounter) {
val = encounter.DateTime + ' ' + encounter.EncounterType;
} else {
val = 'None';
}
document.getElementById('encounter').innerText = val;
});
app.ipcRenderer.on('hieUpdated', function(event, hie) {
if(hie) {
val = hie.emailAddress;
} else {
val = 'None';
}
document.getElementById('user').innerText = val;
});
function sendClose() {
app.remote.getCurrentWindow().close();
}
function submitHandler(e) {
var box = document.getElementById('mainBox');
app.ipcRenderer.send('boxCommand', box.value);
box.value = '';
return false;
}
function doLoad() {
document.getElementById('mainBox').focus();
}
</script>
<div>
<div id='patient'> </div>
<div id='user'>&nsbsp;</div>
<div id='encounter'> </div>
</div>
<form onsubmit='return submitHandler(event);'>
<input id='mainBox' type='text'></input>
<button id='closeButton' type='button' onclick='sendClose();'>Close</button>
</form>
</body>
</html>