/
session.html
37 lines (31 loc) · 1.03 KB
/
session.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
<html>
<head>
<script src="cloudpilot-emu.js"></script>
<link rel="stylesheet" href="sample.css">
</head>
<body>
<h1>Load session file</h1>
<canvas tabindex="1"></canvas>
<a href="index.html">...back to index</a>
|
<a href="https://github.com/cloudpilot-emu/cloudpilot-emu/blob/master/web/embedded/public/session.html">
source on github
</a>
<script>
(async function () {
const imageResponse = await fetch('session.img');
if (!imageResponse.ok) {
throw new Error('could not download session image');
}
const image = await imageResponse.arrayBuffer();
const emulator = await cloudpilot.createEmulator();
const canvas = document.getElementsByTagName('canvas')[0];
emulator.
loadSession(new Uint8Array(image))
.setCanvas(canvas)
.bindInput(canvas)
.resume();
})().catch(e => console.error(e));
</script>
</body>
</html>