Creating Custom Events

How should you structure custom events for optimal performance?
class UserEvents {
  static EVENTS = {
    LOGIN: 'user:login',
    LOGOUT: 'user:logout',
    UPDATE: 'user:update'
  };
  
  static dispatch(eventName, data) {
    const event = new CustomEvent(eventName, {
      bubbles: true,
      detail: data
    });
    document.dispatchEvent(event);
  }
}
Next Question (9/20)