Untitled
4 years ago in HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Ethereum test</title>
<script>
function testCallback(err, res)
{
console.log('@@@ testCallback err:'+err+' res:'+res);
}
function test()
{
console.log('@@@ test');
web3.eth.subscribe('newBlockHeaders', testCallback);
console.log('@@@ test done');
}
</script>
</head>
<body>
<h1>Ethereum test</h1>
<button onclick="test()" type="button">test()</button>
<div id="result">...</div>
</body>
</html>