Skip to content

Instantly share code, notes, and snippets.

@whoisryosuke
Forked from jmakeig/callback.js
Created January 7, 2019 02:39
Show Gist options
  • Save whoisryosuke/152c0f84bfebae046ad5aa56d30a73ac to your computer and use it in GitHub Desktop.
Save whoisryosuke/152c0f84bfebae046ad5aa56d30a73ac to your computer and use it in GitHub Desktop.
JSDoc/Documentation.js examples
/**
* A success callback for {@link ResultProvider} that receives the result from
* the {@link documents#probe}.
* @callback documents#probeResult
* @since 1.0
* @param {documents.DocumentDescriptor} document - a sparse document descriptor with an exists
* property that identifies whether the document exists
*/
/**
* Probes whether a document exists; takes a configuration
* object with the following named parameters or, as a shortcut,
* a uri string.
* @method documents#probe
* @since 1.0
* @param {string} uri - the uri for the database document
* @returns {ResultProvider} an object whose result() function takes
* a {@link documents#probeResult} success callback.
*/
Documents.prototype.probe = function probeDocument() {
return probeDocumentsImpl.call(this, false, mlutil.asArray.apply(null, arguments));
};
/**
* A {@link ChildOfParent} extends {@link Parent} with functionality
* specific to…
*
* @class ChildOfParent
* @augments Parent
* @function
* @param {Object} thing - Factory constructor input
* @returns {ChildOfParent} - A new {@link ChildOfParent}
* @throws {TypeError} - If `thing` is the wrong type
*/
function ChildOfParent(thing) {
if(!(thing instanceof Object)) {
throw new TypeError('Can only wrap an Object');
}
if(!this) { return new ChildOfParent(thing); }
return Parent.call(this, thing);
}
// @function is needed to make it a static constructor, i.e. without `new`
/**
* Description goes here
* @typedef {object} ns.Type
* @since 1.0
* @property {string} param - descrip
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment