Added example 2: Attach and trigger custom events.