Skip to content

Instantly share code, notes, and snippets.

@greggman
Created May 27, 2014 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greggman/02d59667e1cafda2be8f to your computer and use it in GitHub Desktop.
Save greggman/02d59667e1cafda2be8f to your computer and use it in GitHub Desktop.
works on JSDoc 3.3.0-alpha5 with Java but not with node.js
/*
* Some license text, bla bla bal
*/
"use strict";
define(['./somelibrary'], function(SomeLibrary) {
/**
* @typedef {Object} FooThing~Options
* @property {string} fooId id of foo. This is how foos and
* controller rendezvous.
*/
/**
* FooThing is a fake object just to test JSDoc.
*
* IF it's working a foo thing should get documented with 4
* methods and 2 typedefs.
*
* @alias FooThing
* @constructor
* @param {FooThing~Options} options options.
*/
var FooThing = function(options) {
var eventListeners = {};
/**
* returns the foo's fooId
* @returns {String} the foo's fooId
*/
this.getfooId = function() {
return options.fooId;
};
/**
* Adds an event listener for the given event type.
* @param {string} eventType name of event
* @param {FooThing~Listener} listener callback to call for
* event.
*/
this.addEventListener = function(eventType, listener) {
eventListeners[eventType] = listener;
};
/**
* @callback FooThing~Listener
* @param {Object} data data from sender.
*/
/**
* Removes an eventListener
* @param {string} eventType name of event
*/
this.removeEventListener = function(eventType) {
eventListeners[eventType] = undefined;
};
/**
* Sends a command to the foo
* @param {string} cmd name of command
* @param {Object=} data any jsonifyable object.
*/
this.sendCmd = function(cmd, data) {
};
};
return FooThing;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment