<!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});
    }

    function receiveUpdate(update) {
        document.getElementById('output').innerHTML += "<strong>&lt;" + update.payload.addr + "&gt;</strong> " + update.payload.msg + "<br>";
    }

    window.deltachat.setUpdateListener(receiveUpdate);

</script>
</body>
</html>