{% import "lib/macros.html" as lib -%}
{% import "lib/deprecated.html" as x -%}

{%- if doc.events %}
<h2 id="events">Events</h2>
<ul class="events">
  {%- for event in doc.events %}
  <li id="{$ event.name $}">
    <h3 id="event-{$ event.name $}">{$ event.name $}</h3>
    <div>{$ event.description | marked $}</div>

    {$ x.deprecatedBlock(event) $}

    {%- if event.eventType == 'listen' %}
    <div class="inline">
      <h4>Listen on: {$ event.eventTarget $}</h4>
    </div>
    {%- else %}
    <div class="inline">
      <h4>Type:</h4>
      <div class="type">{$ event.eventType $}</div>
    </div>
    <div class="inline">
      <h4>Target:</h4>
      <div class="target">{$ event.eventTarget $}</div>
    </div>
    {% endif -%}
    {%- if event.params %}
    <section class="api-section">
      <h4>Parameters</h4>
      {$ lib.paramTable(event.params) $}
    </section>
    {%- endif -%}
  </li>
  {% endfor -%}
</ul>
{% endif -%}
