Spec-Zone.ru › JSDoc

@implements

Оглавление

  • Синтаксис
  • Обзор
  • Примеры
  • Связанные ссылки

Синтаксис

@implements {typeExpression}

Обзор

Тег @implements указывает, что символ реализует интерфейс.

Добавьте тег @implements к символу верхнего уровня, который реализует интерфейс (например, функции-конструктору). Вам не нужно добавлять тег @implements к каждому элементу реализации (например, методам экземпляра реализации).

Если вы не документируете один из символов в реализации, JSDoc автоматически использует документацию интерфейса для этого символа.

Примеры

В следующем примере класс TransparentColor реализует интерфейс Color и добавляет метод TransparentColor#rgba.

Использование тега @implements
/**
 * Interface for classes that represent a color.
 *
 * @interface
 */
function Color() {}

/**
 * Get the color as an array of red, green, and blue values, represented as
 * decimal numbers between 0 and 1.
 *
 * @returns {Array<number>} An array containing the red, green, and blue values,
 * in that order.
 */
Color.prototype.rgb = function() {
    throw new Error('not implemented');
};

/**
 * Class representing a color with transparency information.
 *
 * @class
 * @implements {Color}
 */
function TransparentColor() {}

// inherits the documentation from `Color#rgb`
TransparentColor.prototype.rgb = function() {
    // ...
};

/**
 * Get the color as an array of red, green, blue, and alpha values, represented
 * as decimal numbers between 0 and 1.
 *
 * @returns {Array<number>} An array containing the red, green, blue, and alpha
 * values, in that order.
 */
TransparentColor.prototype.rgba = function() {
    // ...
};

Связанные ссылки

@interface

© 2011–2017 the contributors to the JSDoc 3 documentation project
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://jsdoc.app/tags-implements.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API