Fasting & Autophagy Tracker

Fasting & Autophagy Tracker

Ready to start?

00:00:00

Autophagy & Ketosis Stages

Not Started
12h
16h
18h
  • 12+ hrs: Ketosis begins. Body starts using fat for energy.
  • 16-18+ hrs: Autophagy starts. Cellular cleanup process is initiated.
  • 24+ hrs: Deeper autophagy and potential for increased growth hormone.

Your Fasting History

Detailed Log

Your logged fasts will appear here.

Download Your Fasting Report

Generate a PDF of your fasting history and trends to track your progress over time.

${new Date().toLocaleDateString()}

Fasting Duration Trend

${chartImageHtml}

Detailed Log

${logHistoryContainer.innerHTML}
`; document.body.appendChild(pdfWrapper); try { const canvas = await html2canvas(pdfWrapper, { scale: 2, useCORS: true, logging: false }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'px', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const imgWidth = canvas.width; const imgHeight = canvas.height; const ratio = imgWidth / imgHeight; let finalImgWidth = pdfWidth; let finalImgHeight = pdfWidth / ratio; if (finalImgHeight > pdfHeight) { finalImgHeight = pdfHeight; finalImgWidth = pdfHeight * ratio; } pdf.addImage(imgData, 'PNG', 0, 0, finalImgWidth, finalImgHeight); pdf.save('Fasting-Report.pdf'); } catch (error) { console.error("PDF Generation Error:", error); } finally { document.body.removeChild(pdfWrapper); downloadPdfBtn.textContent = 'Download PDF Report'; downloadPdfBtn.disabled = false; } } // --- Event Listeners --- startStopBtn.addEventListener('click', () => { state.isRunning ? stopTimer() : startTimer(); }); resetBtn.addEventListener('click', resetTimer); logFastBtn.addEventListener('click', logFast); downloadPdfBtn.addEventListener('click', generatePDF); // --- Initial Call --- loadData(); showTab(0); });
Scroll to Top