Skip to main content

Practice ยท 2 of 2

Delegated Dashboard Events

Model event delegation WITHOUT the DOM. Write createDelegator(onToggle) returning { wire, click } โ€” wire(el, id) registers an element under a task id; click(target) simulates a click on target: if target is a registered element, call onToggle(id) for its CURRENT state, flip that state, and return true; unknown targets return false and do nothing. State per id starts at false (not done).

Difficulty: advanced

Back to lesson: Practice: Dashboard Mini-Build