Add JQHTML-EVENT-01 rule, document custom component events, update jqhtml
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -686,6 +686,12 @@ From within component methods:
|
||||
- **$(selector).component()** → Get component instance from jQuery element
|
||||
- **`await $(selector).component().ready()`** → Await component initialization. Rarely needed - `on_ready()` auto-waits for children created during render. Use for dynamically created components or Blade page JS interaction.
|
||||
|
||||
### Custom Component Events
|
||||
|
||||
Fire: `this.trigger('event_name', data)` | Listen: `this.sid('child').on('event_name', (component, data) => {})`
|
||||
|
||||
**Key difference from jQuery**: Events fired BEFORE handler registration still trigger the callback when registered. This solves component lifecycle timing issues where child events fire before parent registers handlers. Never use `this.$.trigger()` for custom events (enforced by JQHTML-EVENT-01).
|
||||
|
||||
### Dynamic Component Creation
|
||||
|
||||
To dynamically create/replace a component in JavaScript:
|
||||
|
||||
Reference in New Issue
Block a user