replace sent/received bit panels

This commit is contained in:
Lewis Moten
2024-05-11 17:44:26 -04:00
parent 6895e5b7a2
commit 78568bdbaf
5 changed files with 61 additions and 49 deletions

View File

@@ -60,6 +60,10 @@ export const addBits = (
if(hasNewBits(oldBits, bits))
dispatcher.emit('change');
}
const sumSegmentBits = (sum, segment) => sum + segment.length;
const sumPacketBits = (sum, packet) => sum + packet.reduce(sumSegmentBits, 0);
export const sumTotalBits = () => BITS.reduce(sumPacketBits, 0);
const hasNewBits = (oldBits = [], bits = []) => {
if(oldBits.length === 0 && bits.length === BITS_PER_SEGMENT)
return true;