SaaS/public/main.js
Claude Code bfbb2c7fa5 Initial commit: Click Counter SaaS Application
- Express.js server with static file serving
- Click counter frontend with localStorage persistence
- Optimized Docker setup with multi-stage build
- Production-ready configuration with health checks
- Automated deployment script for VPS
- Comprehensive deployment documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-29 10:25:12 +01:00

32 lines
775 B
JavaScript

(function() {
const valueEl = document.getElementById('value');
const incEl = document.getElementById('inc');
const resetEl = document.getElementById('reset');
const STORAGE_KEY = 'clickCounterValue';
function readValue() {
const v = parseInt(localStorage.getItem(STORAGE_KEY) || '0', 10);
return Number.isFinite(v) ? v : 0;
}
function writeValue(v) {
localStorage.setItem(STORAGE_KEY, String(v));
}
function render(v) {
valueEl.textContent = String(v);
}
let current = readValue();
render(current);
incEl.addEventListener('click', () => {
current += 1;
writeValue(current);
render(current);
});
resetEl.addEventListener('click', () => {
current = 0;
writeValue(current);
render(current);
});
})();