Skip to content

Put custom event definitions into externs #1564

@joeyparrish

Description

@joeyparrish

Right now, the events we dispatch are only described at the jsdoc level, not in any actual Closure types. For example:

/**
 * @event shaka.Player.ErrorEvent
 * @description Fired when a playback error occurs.
 * @property {string} type
 *   'error'
 * @property {!shaka.util.Error} detail
 *   An object which contains details on the error.  The error's 'category' and
 *   'code' properties will identify the specific error that occurred.  In an
 *   uncompiled build, you can also use the 'message' and 'stack' properties
 *   to debug.
 * @exportDoc
 */

It would be ideal to make these part of the generated externs, so that projects building with Closure (and some day TypeScript (#1273)) could use these event types.

To do that, I'm not sure of the best approach. Probably, the event types should be promoted to proper types in Closure. Then the existing extern generator could pick them up and describe them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions