-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
59 lines (58 loc) · 2.29 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Cantoo Api</title>
<style type="text/css">
.button {
padding: 1em;
cursor: pointer;
}
</style>
<script type="module">
import CantooAPI from './cantooApi.js'
addEventListener('load', () => {
function connect() {
CantooAPI.connect({
domElement: document.getElementById('test'),
env: 'develop',
fileId: undefined,
idEnt: 'Test',
uai: '0999080T',
userId: 'test-user',
readOnly: false,
template: 'cabri',
title: 'test'
}).then(cantoo => {
document.getElementById('close').setAttribute('style', 'display:inline;')
cantoo.addEventListener('ready', function () { console.log('ready', ...arguments) })
cantoo.addEventListener('completed', function () { console.log('completed', ...arguments) })
cantoo.addEventListener('destroyed', function () { console.log('destroyed', ...arguments) })
document.getElementById('close').addEventListener('click', () => {
cantoo.destroy()
document.getElementById('close').setAttribute('style', 'display:none;')
document.getElementById('reload').setAttribute('style', 'display:inline;')
})
document.getElementById('reload').addEventListener('click', () => {
connect()
document.getElementById('reload').setAttribute('style', 'display:none;')
document.getElementById('close').setAttribute('style', 'display:none;')
})
})
}
console.log('connecting')
connect()
})
</script>
</head>
<body style="height:100vh;width:100vw;margin:0;">
<div style="height: 100%;display:flex;flex-direction:column;align-items:stretch;">
<h1>Here is your iframe</h1>
<button class='button' style="display: none;" id="close">close</button>
<button class='button' style="display: none;" id="reload">reload</button>
<div id="test" style="flex:1 1 0;display:flex;"></div>
</div>
</body>
</html>