Source: wk/pattern/observer/Event.js

/**
 * @author    Wolfgang Kowarschick <kowa@hs-augsburg.de>
 * @copyright 2017 - 2018
 * @license   CC-BY-NC-SA-4.0
 */

/**
 * Event objects are those objects that are dispatched by an
 * [event dispatcher]{@link EventDispatcher}.
 *
 * @class
 */
class Event
{ /**
   * @param {?Object} init
   * @param {?Object} init.type
   *                  The type of the event.
   * @param {?Object} init.category
   *                  The category of the event.
   * @param {?Object} init.detail
   *                  The detail information of the event.
   */
  constructor({type:     p_type     = null,
               category: p_category = null,
               detail:   p_detail   = null
             })
  { this.v_type     = p_type;
    this.v_category = p_category;
    this.v_detail   = p_detail;
  }
  
  /**
   * The type of the event.
   * @member {string}
   */
  get type()     { return this.v_type;     }
  
  /**
   * The category of the event.
   * @member {string}
   */
  get category() { return this.v_category; }
  
  /**
   * Event specific detail information.
   * @member {Object}
   */
  get detail()   { return this.v_detail;   }
}

export {Event};
export default Event;