All files / core/src/events index.js

33.33% Statements 1/3
100% Branches 0/0
0% Functions 0/1
33.33% Lines 1/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74                                                                                          10x                                                        
/**
 * Coherent.js Event Bus System
 *
 * A comprehensive event-driven architecture for Coherent.js applications.
 * Provides centralized event management, DOM integration, and component utilities.
 */
 
// Core event bus
export {
    EventBus,
    createEventBus,
    globalEventBus,
    emit,
    emitSync,
    on,
    once,
    off,
    registerAction,
    handleAction
} from './event-bus.js';
 
// DOM integration
export {
    DOMEventIntegration,
    globalDOMIntegration,
    initializeDOMIntegration
} from './dom-integration.js';
 
// Component integration
export {
    withEventBus,
    withEventState,
    createActionHandlers,
    createEventHandlers,
    createEventComponent,
    emitEvent
} from './component-integration.js';
 
// Re-export for convenience
import { globalEventBus } from './event-bus.js';
import { globalDOMIntegration } from './dom-integration.js';
 
/**
 * Default export with all event system functionality
 */
const eventSystem = {
    // Core bus
    bus: globalEventBus,
    dom: globalDOMIntegration,
 
    // Quick access methods
    emit: globalEventBus.emit.bind(globalEventBus),
    emitSync: globalEventBus.emitSync.bind(globalEventBus),
    on: globalEventBus.on.bind(globalEventBus),
    once: globalEventBus.once.bind(globalEventBus),
    off: globalEventBus.off.bind(globalEventBus),
 
    // Action methods
    registerAction: globalEventBus.registerAction.bind(globalEventBus),
    registerActions: globalEventBus.registerActions.bind(globalEventBus),
    handleAction: globalEventBus.handleAction.bind(globalEventBus),
 
    // Statistics and debugging
    getStats: globalEventBus.getStats.bind(globalEventBus),
    resetStats: globalEventBus.resetStats.bind(globalEventBus),
 
    // Lifecycle
    destroy() {
        globalEventBus.destroy();
        globalDOMIntegration.destroy();
    }
};
 
export default eventSystem;