angular-jsdoc icon indicating copy to clipboard operation
angular-jsdoc copied to clipboard

How to document events?

Open trsrm opened this issue 9 years ago • 8 comments
trafficstars

How to document events with cross-links, '@fires', '@listens', etc.?

trsrm avatar Apr 05 '16 12:04 trsrm

At this time I have a [partial] fix for this in the template. I can create a pull request and ask the author to pull it in.

For the time being you can create a custom template and modify html/class.html and insert this code (i put this above the "Members" subsection title because it's a copy of the "Members" template code.

<div class="events" ht-if="children.event">
    <h3 class="subsection-title">Events</h3>
    <table class="props">
        <thead>
            <tr>
                <th>Name</th>
                <th>Type</th>
                <th class="last">Description</th>
            </tr>
        </thead>
        <tbody>
            <tr ht-repeat="event in children.event">
                <td class="name" nowrap>{{ event.name }}</td>
                <td class="type" nowrap>{{ event.eventType }}</td>
                <td class="description last">{{ event.description }}</td>
            </tr>
        </tbody>
    </table>
    <br />
    <br />
</div>

Now the Events template code above works with a doc block like this (right now I don't have one for @fires).

          /**
           * @ngdoc event
           * @event Simpl.Entities.$userEntity#onUserUpdated
           * @name Simpl.Entities.$userEntity#onUserUpdated
           * @description Broadcasts the updated user object to the root scope.
           * @eventof Simpl.Entities.$userEntity
           * @eventType broadcast
           */

reloaded avatar Apr 18 '16 15:04 reloaded

@allenhwkim See the above comment. If I create a pull request this week do you have an ETA on when you could review and merge it?

reloaded avatar Apr 18 '16 15:04 reloaded

Just submit the PR. I’ll review it in case @allenhwkim doesn’t have time.

Zemke avatar Apr 18 '16 16:04 Zemke

@Zemke Should the change to support @fires, @listens and @event be made to both templates or just the angular-template?

reloaded avatar Apr 18 '16 19:04 reloaded

I have made angular-template for the convenience and I thought it was cool to have html-based template. However, if no one sees the benefit, I am open to drop it for the sake of maintenance.

@Zemke thanks for your support for this. I really appreciate it.

allenhwkim avatar Apr 19 '16 20:04 allenhwkim

@allenhwkim I like the way the angular-template works with the angular-like templating engine. If anything I would say deprecate/drop the "default" template or make the angular-template the "default" and git rid of what is now known as "default". Trying to keep two completely different templates up to date is extra overhead.

I'm in the process of creating a PR to add support for @event, @listens and @fires.

reloaded avatar Apr 19 '16 22:04 reloaded

@Zemke I already have a branch that adds this functionality. I will create a PR for this today.

reloaded avatar Apr 21 '16 23:04 reloaded

Any movement on this?

brianpkelley avatar Mar 13 '17 14:03 brianpkelley