Files
michaelschiemer/resources/js/modules/state-manager/index.js
Michael Schiemer 36ef2a1e2c
Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Failing after 10m14s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Has been skipped
🚀 Build & Deploy Image / Build Docker Image (push) Has been skipped
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
Security Vulnerability Scan / Check for Dependency Changes (push) Failing after 11m25s
Security Vulnerability Scan / Composer Security Audit (push) Has been cancelled
fix: Gitea Traefik routing and connection pool optimization
- Remove middleware reference from Gitea Traefik labels (caused routing issues)
- Optimize Gitea connection pool settings (MAX_IDLE_CONNS=30, authentication_timeout=180s)
- Add explicit service reference in Traefik labels
- Fix intermittent 504 timeouts by improving PostgreSQL connection handling

Fixes Gitea unreachability via git.michaelschiemer.de
2025-11-09 14:46:15 +01:00

76 lines
2.0 KiB
JavaScript

/**
* State Manager Module
*
* Provides centralized, reactive state management for client-side state.
*
* Usage:
* - Add data-module="state-manager" to enable global state management
* - Or import and use directly: import { StateManager } from './modules/state-manager/index.js'
*
* Features:
* - Reactive state store
* - State persistence (localStorage, sessionStorage)
* - Cross-tab synchronization
* - Integration with LiveComponents
* - Time-travel debugging
*/
import { Logger } from '../../core/logger.js';
import { StateManager, getGlobalStateManager, createScopedStateManager } from './StateManager.js';
const StateManagerModule = {
name: 'state-manager',
stateManager: null,
init(config = {}, state = null) {
Logger.info('[StateManagerModule] Module initialized');
// Create global state manager
this.stateManager = getGlobalStateManager(config);
// Expose globally for easy access
if (typeof window !== 'undefined') {
window.StateManager = this.stateManager;
}
return this;
},
/**
* Get state manager instance
*/
getStateManager() {
return this.stateManager || getGlobalStateManager();
},
/**
* Create a scoped state manager
*/
createScoped(config = {}) {
return createScopedStateManager(config);
},
destroy() {
if (this.stateManager) {
this.stateManager.destroy();
this.stateManager = null;
}
if (typeof window !== 'undefined' && window.StateManager) {
delete window.StateManager;
}
Logger.info('[StateManagerModule] Module destroyed');
}
};
// Export for direct usage
export { StateManager, getGlobalStateManager, createScopedStateManager };
// Export as default for module system
export default StateManagerModule;
// Export init function for module system
export const init = StateManagerModule.init.bind(StateManagerModule);