Skip to content

Commit

Permalink
remove memory monitoring function in live repo
Browse files Browse the repository at this point in the history
  • Loading branch information
rbi-aap committed Sep 16, 2024
1 parent 1019cb7 commit 61e88d5
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions assets/ui/components/ArticleBodyHtml.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class ArticleBodyHtml extends React.PureComponent {
document.addEventListener('copy', this.copyClicked);
document.addEventListener('click', this.clickClicked);
this.addContextMenuEventListeners();
// this.startMemoryUsageTracking();
}

componentDidUpdate(prevProps) {
Expand All @@ -49,25 +48,6 @@ class ArticleBodyHtml extends React.PureComponent {

this.players.forEach(player => player.destroy());
this.players.clear();

// if (this.memoryInterval) {
// clearInterval(this.memoryInterval);
// }
}

startMemoryUsageTracking() {
if (window.performance && window.performance.memory) {
this.memoryInterval = setInterval(() => {
const memoryInfo = window.performance.memory;
this.setState({
memoryUsage: {
usedJSHeapSize: memoryInfo.usedJSHeapSize / (1024 * 1024),
totalJSHeapSize: memoryInfo.totalJSHeapSize / (1024 * 1024),
jsHeapSizeLimit: memoryInfo.jsHeapSizeLimit / (1024 * 1024)
}
});
}, 2000);
}
}

updateSanitizedHtml() {
Expand Down Expand Up @@ -240,7 +220,7 @@ class ArticleBodyHtml extends React.PureComponent {
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
const data = imageData.data;
// loop for none blank pixel
let stepSize = 8; // Adjust the step size
let stepSize = 10; // Adjust the step size
for (let i = 0; i < data.length; i += stepSize * 4) {
if (data[i] > 0 || data[i + 1] > 0 || data[i + 2] > 0) {
console.warn('Pixel content detected, poster not needed');
Expand Down

0 comments on commit 61e88d5

Please sign in to comment.