Skip to content

Commit df9df1a

Browse files
authored
cast to string and delay
1 parent 01ab6df commit df9df1a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/addons/addons/block-count/blockcount.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default async function ({ addon, console, msg }) {
2424
const thisWS = targetBlocks.find((i) => i[0] === thisTargetID);
2525
if (thisWS) thisBlockCount += thisWS[1];
2626

27-
if (thisBlockCount === allBlockCount) return allBlockCount;
27+
if (thisBlockCount === allBlockCount) return "" + allBlockCount;
2828
return `${thisBlockCount} / ${allBlockCount}`;
2929
};
3030

@@ -59,11 +59,11 @@ export default async function ({ addon, console, msg }) {
5959
const now = Date.now();
6060
if (
6161
counterElement &&
62-
now > lastUpdateTime + 1000 && // dont update the count multiple times in a second
62+
now > lastUpdateTime + 300 && // dont update the count multiple times in a second
6363
(event.type === events.DELETE || event.type === events.CREATE)
6464
) {
6565
lastUpdateTime = now;
66-
counterElement.innerText = msg("blocks", { num: getBlockCount() });
66+
counterElement.innerText = msg("blocks", { text: getBlockCount() });
6767
}
6868
};
6969

0 commit comments

Comments
 (0)