* - Refactoring code. - Refactoring folder structure. - Adding apiEndpoint and websocketEndpoint to Mempool config. - Adding brownserify feature. - Adding MIT LICENSE * - Changing package.json information. - Reorganizing README.md information. - Default export for CommonJs and ES6 Modules. - Changing default variable to mempoolJS. - Organizing the API and WS providers. - Splitting websocket connection types: client and server. * Change version to 2.2.0. Reorder keywords in alphabetical order.
37 lines
940 B
HTML
37 lines
940 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Page Title</title>
|
|
<script src="./../../dist/mempool.js"></script>
|
|
<script>
|
|
const init = async () => {
|
|
const { websocket } = mempoolJS();
|
|
|
|
const ws = await websocket.initClient({
|
|
options: ['blocks', 'stats', 'mempool-blocks', 'live-2h-chart'],
|
|
});
|
|
|
|
ws.addEventListener('message', function incoming({ data }) {
|
|
const res = JSON.parse(data);
|
|
if (res.blocks) {
|
|
res.blocks.forEach((block) => {
|
|
console.log(block.height);
|
|
});
|
|
}
|
|
if (res.mempoolInfo) {
|
|
console.log(res.mempoolInfo);
|
|
}
|
|
if (res.transactions) {
|
|
console.log(res.transactions);
|
|
}
|
|
if (res.mempoolBlocks) {
|
|
console.log(res.mempoolBlocks);
|
|
}
|
|
});
|
|
};
|
|
init();
|
|
</script>
|
|
</head>
|
|
<body></body>
|
|
</html>
|