Some checks failed
Deploy to GitHub Pages / build-and-deploy (push) Has been cancelled
26 lines
1.0 KiB
JavaScript
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);
|
|
});
|
|
});
|
|
}
|
|
}); |