yvesgurcan/web-midi-player

Feature: Document all event names

Opened this issue · 0 comments

Problem

Describe the problem related to this feature request.

It isn't clear from the documentation what the name of the events that are emitted is or when they get emitted.

Solution

What solution do you suggest to solve this problem?

Add these event names (such as MIDI_PLAY and MIDI_ERROR) to the documentation, using JSDoc.

In the documentation, the name of the events should be found in what the relevant methods of the EventHandler return.

For example, for the emitInit method, we could document what it returns with something like that:

 /*
     * Emits an event that indicates that the MIDI player is initialized.
     * @function
     * @param {undefined}
     * @return {object} payload
     * @return {string} payload.event `'MIDI_INIT'`
     * @return {string} payload.message `'MIDI player initialized.'`
  */

emitInit() {
this.emitEvent({
event: MIDI_INIT,
message: 'MIDI player initialized.'
});
}