-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetchPhoto.html
More file actions
44 lines (40 loc) · 1.08 KB
/
fetchPhoto.html
File metadata and controls
44 lines (40 loc) · 1.08 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
<html>
<head>
</head>
<body style="background-color: black; text-align: center;">
<script>
let img = document.createElement('img');
img.style = 'width:auto%;height:100%;';
document.body.append(img);
function putItThere()
{
try
{
(async ()=>
{
let response = await fetch("http://127.0.0.1:3001/pidv");
let blob = await response.blob(); // download as Blob object
// show it
img.src = URL.createObjectURL(blob);
})()
}
catch (err) {
throw err
}
finally {
console.log('finalmente');
}
}
function handleKeyPres(event)
{
event.preventDefault();
if (event.keyCode == 32)
{
putItThere();
}
}
document.addEventListener("keypress", handleKeyPres, false);
putItThere();
</script>
</body>
</html>