Files
geek-calc/app.js
snowprint 54f427ea21
Some checks failed
Deploy to GitHub Pages / build-and-deploy (push) Has been cancelled
init geek calc
2025-10-04 10:53:41 +08:00

26 lines
1.0 KiB
JavaScript

// Main application file for Geek Calculator
// Initialize the application when DOM is loaded
document.addEventListener('DOMContentLoaded', () => {
// Create instances of our calculator components
const calculator = new Calculator.Calculator();
const rpnCalculator = new RPNCalculator.RPNCalculator();
const stateManager = new StateManager.StateManager();
const uiController = new UIController.UIController(calculator, rpnCalculator, stateManager);
// Initialize the UI
uiController.init();
// Register service worker for offline capability if supported
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('./service-worker.js')
.then(registration => {
console.log('ServiceWorker registration successful');
})
.catch(err => {
console.log('ServiceWorker registration failed', err);
});
});
}
});