Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmulti.html
More file actions
Latest commit
57 lines (49 loc) · 1.64 KB
/
Copy pathmulti.html
File metadata and controls
57 lines (49 loc) · 1.64 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
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="UTF-8">
<metaname="viewport" content="width=device-width, initial-scale=1.0">
<title>Two playgrounds on one page</title>
<linkrel="stylesheet" href="./dist/index.css">
<style>
body {
margin:0;
font-family: system-ui, -apple-system, sans-serif;
}
java-memory-playground {
display: block;
width:100vw;
height:50vh;
border-bottom:2px solid #333;
}
</style>
</head>
<body>
<java-memory-playgroundid="a"></java-memory-playground>
<java-memory-playgroundid="b"></java-memory-playground>
<scriptsrc="./dist/index.umd.js"></script>
<script>
consta=document.getElementById('a');
constb=document.getElementById('b');
a.setAttribute('memory',JSON.stringify({
options: {hideSidebar: true},
klasses: {Node: {attributes: {next: "Node"}}},
objects: {
"@aa": {klass: "Node",attributes: {next: {dataType: "Node"}},position: {x: 300,y: 60}}
},
variables: {},
methodCalls: {1: {name: "A.first",index: 0,localVariables: {},position: {x: 0,y: 0}}}
}));
b.setAttribute('memory',JSON.stringify({
options: {hideSidebar: true},
klasses: {},
objects: {},
variables: {},
methodCalls: {1: {name: "B.second",index: 0,localVariables: {},position: {x: 0,y: 0}}}
}));
window.__changes=[];
a.addEventListener('change',(e)=>window.__changes.push({from: 'a',detail: e.detail}));
b.addEventListener('change',(e)=>window.__changes.push({from: 'b',detail: e.detail}));
</script>
</body>
</html>