-
Notifications
You must be signed in to change notification settings - Fork 239
/
build-demo.html
44 lines (41 loc) · 1.39 KB
/
build-demo.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
<!doctype html>
<html lang="en">
<head></head>
<body>
<script src="dist/vendor.js"></script>
<script src="dist/apic-import.js"></script>
<api-navigation compatibility></api-navigation>
<api-documentation compatibility handlenavigationevents></api-documentation>
<api-request-panel compatibility handlenavigationevents></api-request-panel>
<xhr-simple-request></xhr-simple-request>
<script>
{
function loadImportScript() {
var is = document.createElement('script');
is.src = 'dist/apic-import.js';
document.body.appendChild(is);
}
if (navigator.userAgent.indexOf('Trident') !== -1) {
setTimeout(loadImportScript, 1);
} else {
loadImportScript();
}
var resource = 'demo/models/google-drive-api-compact.json';
var xhr = new XMLHttpRequest();
xhr.addEventListener('load', function(e) {
var response = e.target.responseText;
var model = JSON.parse(response);
var nodes = document.querySelectorAll('api-request-panel,api-navigation,api-documentation');
for (var i = 0; i < nodes.length; i++) {
nodes[i].amf = model;
}
});
xhr.addEventListener('error', function(e) {
console.error('Request errored with status', e.target.status);
});
xhr.open('GET', resource);
xhr.send();
}
</script>
</body>
</html>