Javascript API
This section provides an overview of AriaDocs.
What is WebCli Module
The WebCli module creates a comprehensive JavaScript-based API and command-line interface for Elementor that's accessible through the browser console.
It exposes a global $e object that provides developers with powerful tools to interact with Elementor programmatically.
Core Functionality
- Global API Access: Creates window.$e - a global JavaScript object that developers can use in the browser console or scripts
- Command System: Provides a robust command infrastructure with:
- Public Commands ($e.commands) - For general operations
- Internal Commands ($e.commandsInternal) - For internal Elementor operations
- Data Commands ($e.data) - For data operations
- Command registration, execution, validation, and tracing
- Shortcut support for commands
- Component Architecture:
- Modular component system ($e.components)
- Component registration and management
- Modal components support
- Hooks System ($e.hooks): WordPress-style hooks for:
- Actions and filters
- UI hooks
- Data hooks
- Routing ($e.routes): Navigation and routing capabilities
- Data Management ($e.data): Centralized data operations
- State Management ($e.store, $e.uiStates): Application state management
- Utilities:
- Console logging with Elementor branding
- Shortcuts system
- Hash-based commands
- Backwards compatibility layer
- Developer Benefits
- This module essentially turns the browser console into a powerful debugging and development tool for Elementor, allowing developers to:
- Execute Elementor commands directly from the console
- Inspect and manipulate Elementor's internal state
- Test component functionality
- Debug issues with proper error handling and tracing
- Access Elementor's data layer programmatically
- Navigate between different Elementor views/routes