mirror of
https://github.com/seigler/dash-visualizer
synced 2025-07-26 01:06:12 +00:00
feat: limit visualization to 100 elements
This commit is contained in:
parent
ffd6f7e41a
commit
3e6057e624
2 changed files with 10 additions and 0 deletions
9
app.js
9
app.js
|
@ -11,6 +11,7 @@
|
|||
'tx': null,
|
||||
'block': null
|
||||
};
|
||||
var domRefList = [];
|
||||
window.addEventListener('load', init, false);
|
||||
|
||||
function init() {
|
||||
|
@ -122,6 +123,10 @@
|
|||
txOut.title = (value[Object.keys(value)[0]] * 0.00000001);
|
||||
txOutputs.appendChild(txOut);
|
||||
});
|
||||
if (domRefList.unshift(tx) > 100) {
|
||||
var toDelete = domRefList.pop();
|
||||
toDelete.remove();
|
||||
}
|
||||
transactionList.insertBefore(tx, transactionList.firstChild);
|
||||
};
|
||||
|
||||
|
@ -134,6 +139,10 @@
|
|||
newBlock.target = '_blank';
|
||||
newBlock.setAttribute('rel', 'noopener');
|
||||
newBlock.appendChild(document.createTextNode(data));
|
||||
if (domRefList.unshift(newBlock) > 100) {
|
||||
var toDelete = domRefList.pop();
|
||||
toDelete.remove();
|
||||
}
|
||||
transactionList.insertBefore(newBlock, transactionList.firstChild);
|
||||
};
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ body {
|
|||
background-color: hsl(208, 73%, 43%);
|
||||
color: white;
|
||||
min-height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
* {
|
||||
box-sizing: inherit;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue