-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
63 lines (61 loc) · 1.72 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Terrar.js demo</title>
<script src="https://unpkg.com/terrar@latest/dist/terrar.umd.js"></script>
</head>
<body>
<h1>I'm outside</h1>
<style>
h1 {
background: green;
}
</style>
<script>
document.querySelector("h1").innerHTML += " <small>(i'm appended from script)</small>";
</script>
<terrar-frame>
<template>
<h1 class="test">I'm in a Terrar frame</h1>
<style>
h1 {
background: cyan;
}
</style>
<script>
document.querySelector("h1").innerHTML += " <small>(i'm appended from script)</small>";
</script>
</template>
</terrar-frame>
<div id="receiver"></div>
<template class="content">
<h1 class="test">I'm in a Terrar frame</h1>
<style>
h1 {
background: magenta;
}
</style>
<script>
document.querySelector("h1").innerHTML += " <small>(i'm appended from script)</small>";
</script>
</template>
<script>
window.addEventListener("load", function () {
const startTime = Date.now();
const receiver = document.querySelector("#receiver");
const content = document.querySelector(".content").innerHTML;
for (let n = 0; n < 50; n++) {
const frame = terrar.createFrame(content)
if (n === 49) {
frame.onRendered(() => {
console.log("EXECUTION TIME : ", Date.now() - startTime, "ms")
})
}
receiver.appendChild(frame);
}
})
</script>
</body>
</html>