Javascript SDK of WoopChain protocol
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
sdk/examples/temp.html

76 lines
1.5 KiB

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no" />
<meta name="format-detection" content="email=no" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
/>
<title></title>
</head>
<style>
#nodeUrl,
#address {
width: 250px;
height: 50px;
font-size: 16px;
}
#setProviderButton,
#getBlanceButton {
width: 100px;
height: 50px;
margin-left: 16px;
background: rgba(0, 0, 0, 1);
color: #ffffff;
}
</style>
<body>
<div id="root">
</div>
<script src="../dist/HarmonyJs.browser.js"></script>
<script>
const harmony= new HarmonyJs.Harmony('ws://localhost:9128',0);
// console.log()
const biubiubiu = async () => {
const p= await harmony.blockchain.newBlockHeaders()
// harmony.blockchain.newBlockHeaders()
p.onData(res=>{
console.log(res)
}).on('error',error=>{
console.log(error)
})
setTimeout(()=>{
if(p.subscriptions!=={}){
p.clearSubscriptions('eth_unsubscribe').then(res=>{
if(res){
console.log('Successfully unsubscribed!')
}
})
}
},50000)
}
setTimeout(biubiubiu, 100);
</script>
</body>
</html>