Skip to content

[Question] Are mixins supported? #885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Mustack opened this issue Aug 18, 2017 · 1 comment
Closed

[Question] Are mixins supported? #885

Mustack opened this issue Aug 18, 2017 · 1 comment

Comments

@Mustack
Copy link

Mustack commented Aug 18, 2017

I'm wondering if I'm doing something wrong, or if what I'm trying to do just isn't supported. If you would be so kind, could you please let me know if I'm doing something wrong. I'd love to hear your thoughts.

I'm trying to use @mixin and @mixes to document objects that I'm composing from mixins, rather than repeat myself for every object that mixes a given mixin. I tried copy-pasting the example for @mixin/@mixes on JSDOC at http://usejsdoc.org/tags-mixes.html and running documentation build mixin.html. It doesn't seem to work as I would have expected.

Expected Result:
-FormButton would be documented as having an on and a fire function.

Actual Result:
-FormButton has no documented functions. Screenshot below:
screen shot 2017-08-18 at 3 10 02 pm

The copied code:

/**
 * This provides methods used for event handling. It's not meant to
 * be used directly.
 *
 * @mixin
 */
var Eventful = {
    /**
     * Register a handler function to be called whenever this event is fired.
     * @param {string} eventName - Name of the event.
     * @param {function(Object)} handler - The handler to call.
     */
    on: function(eventName, handler) {
        // code...
    },

    /**
     * Fire an event, causing all handlers for that event name to run.
     * @param {string} eventName - Name of the event.
     * @param {Object} eventData - The data provided to each handler.
     */
    fire: function(eventName, eventData) {
        // code...
    }
};

/**
 * @constructor FormButton
 * @mixes Eventful
 */
var FormButton = function() {
    // code...
};
FormButton.prototype.press = function() {
  this.fire('press', {});
}
mix(Eventful).into(FormButton.prototype);

Documentation version: 5.2.1

@tmcw
Copy link
Member

tmcw commented Aug 28, 2017

Mixins are not displayed - we track overall tag completion in #9. For this example, we'd probably use class extends instead, if you're using ES6, but nonetheless - answer is that this isn't implement yet, unfortunately! Closing in favor of #9, where this is tracked. If you feel like helping out, please do - I'd be happy to review a PR.

@tmcw tmcw closed this as completed Aug 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants