feat: limit visualization to 100 elements

This commit is contained in:
Joshua Seigler 2016-09-13 10:04:22 -04:00
parent ffd6f7e41a
commit 3e6057e624
2 changed files with 10 additions and 0 deletions

9
app.js
View file

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

View file

@ -12,6 +12,7 @@ body {
background-color: hsl(208, 73%, 43%);
color: white;
min-height: 100vh;
overflow: hidden;
}
* {
box-sizing: inherit;