Skip to content

Commit d396574

Browse files
committed
add missing files
1 parent aab28dd commit d396574

2 files changed

Lines changed: 632 additions & 0 deletions

File tree

index.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8"/>
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
7+
<script src="webxdc.js"></script>
8+
</head>
9+
<body>
10+
<h1>Hello World!</h1>
11+
<form>
12+
<input id="input" type="text" placeholder="Message" autofocus />
13+
<input type="submit" onclick="sendMsg(); return false;" value="Send" />
14+
</form>
15+
<p id="output"></p>
16+
<p><em><small id="deviceName"></small></em></p>
17+
<script>
18+
// handle past and future state updates
19+
window.webxdc.setUpdateListener(function (update) {
20+
document.getElementById('output').innerHTML += "<strong>" + update.payload.name + ":</strong> " + update.payload.msg + "<br>";
21+
});
22+
23+
function sendMsg() {
24+
msg = document.getElementById("input").value;
25+
info = 'someone typed "' + msg + '"';
26+
document.getElementById("input").value = '';
27+
28+
// send new updates
29+
window.webxdc.sendUpdate({
30+
payload: {
31+
name: window.webxdc.selfName,
32+
msg,
33+
},
34+
info,
35+
}, info);
36+
}
37+
38+
(function () {
39+
window.deviceName.innerHTML = 'You are: ' + window.webxdc.selfName;
40+
})()
41+
</script>
42+
</body>
43+
</html>

0 commit comments

Comments
 (0)