jsnes/index.html

27 lines
700 B
HTML
Raw Normal View History

2021-12-31 00:27:45 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script src="deltachat.js"></script>
</head>
<body>
<input id="input" type="text"/>
<a href="" onclick="sendMsg(); return false;">Send</a>
<p id="output"></p>
<script>
function sendMsg() {
msg = document.getElementById("input").value;
window.deltachat.sendUpdate('someone typed "'+msg+'"', {"addr": window.deltachat.selfAddr(), "msg": msg});
2021-12-31 00:27:45 +00:00
}
function receiveUpdate(update) {
document.getElementById('output').innerHTML += "<strong>&lt;" + update.payload.addr + "&gt;</strong> " + update.payload.msg + "<br>";
2021-12-31 00:27:45 +00:00
}
window.deltachat.setUpdateListener(receiveUpdate);
</script>
</body>
</html>