API Reference
Comprehensive documentation of all public APIs, methods, and interfaces available in the Eiseniiaiia framework.
📘 Reference Documentation
Event System API
The event system enables communication between modules through observable patterns.
// Emit an event
Module.events.emit('system.update', {
status: 'active',
timestamp: Date.now()
});
// Listen for events
Module.events.on('data.process', (payload) => {
console.log('Received data:', payload);
});
Available Methods
emit(event, data)
Trigger event with payload
on(event, handler)
Register event listener
once(event, handler)
Single-use event handler
off(event, handler)
Remove specific listener
Configuration API
Access and manage runtime configuration values through hierarchical modules.
// Get configuration value
const timeout = Module.config.get('system.timeout');
// Set configuration value
Module.config.set('features.debug', true);
// Watch for changes
Module.config.watch('environment', (newVal) => {
console.log('Environment changed to:', newVal);
});
Configuration Hierarchy
Project Root
Module Level
Instance Specific
Default Configuration
timeout
: 3000ms - request timeout
debug
: false - enable debug logs
Utility Functions
Logger Utility
// Standard logging
Module.logger.info('System initialized');
Module.logger.warn('Memory usage high');
Module.logger.error('Database connection failed', {
code: 'CONN_FAIL',
timestamp: Date.now()
});
Type Checks
import { Type } from '@eiseniiaiia/core';
if (Type.isObject(payload)) {
console.log('Valid object');
} else {
console.log('Invalid input');
}
Environment Checks
if (process.isNode) {
// Node.js only
} else {
// Browser or worker
}