-
Notifications
You must be signed in to change notification settings - Fork 206
feat: component events #405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ability to pass event handlers through config for common events such as onAdd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces an enhanced component event system that provides a consistent, flexible event handling mechanism for component lifecycle events. The implementation follows a pattern similar to the existing action config in dom.js, allowing developers to configure and respond to various component lifecycle events.
Key Changes:
- Added comprehensive event system to Component class with addEventListener, removeEventListener, and dispatchComponentEvent methods
- Integrated event dispatching into lifecycle methods (onAdd, onRemove, addChild, onRender, clone, and data updates)
- Maintained full backwards compatibility with existing event handlers
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/js/components/component.js | Core implementation of event system including Map-based event storage, event dispatching, and lifecycle integration |
| src/lib/js/components/component-events.test.js | Test suite covering event initialization, add/remove listeners, dispatching, error handling, and update events |
| src/lib/js/components/panels.js | Added radix parameter to parseInt for proper number parsing |
| src/lib/js/common/dom.js | Removed unused conditions variable from destructuring |
| src/demo/js/options/enhanced-config-example.js | Comprehensive example demonstrating new event system capabilities |
| src/demo/js/options/config.js | Updated to use new event system with enhanced onAdd handler |
| docs/component-events.md | Complete documentation of event system including API reference and migration guide |
| docs/README.md | Added link to component events documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
🎉 This PR is included in version 4.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
ability to pass event handlers through config for common events such as onAdd
resolves #381 #348 #279