Skip to content

Commit

Permalink
Add infrastructure to generate jsdoc
Browse files Browse the repository at this point in the history
And a few jsdocs to see how they look like.
  • Loading branch information
gcampax committed Sep 30, 2019
1 parent b925cae commit 5a65df3
Show file tree
Hide file tree
Showing 9 changed files with 518 additions and 114 deletions.
37 changes: 37 additions & 0 deletions index.js
Expand Up @@ -26,22 +26,59 @@ const BasePlatform = require('./lib/base_platform');

const ThingTalk = require('thingtalk');

/**
* Versioning information for the library.
*
* Use this object to check if the currently loaded Thingpedia SDK
* is compatible with your device, and to dynamically check if a specific
* feature is present.
*
* Note: you should never bundle the Thingpedia SDK with your device.
*
* @alias version
* @namespace
*/
const VERSION = {
/** Major version number (incremented on incompatible changes) */
major: 2,
/** Minor version number (incremented on feature additions) */
minor: 6,
/** Full version string, in semantic version format */
full: '2.6.0-alpha.1',
/** Convert the version number to a number (for comparisons) */
valueOf() {
return this.major * 100 + this.minor;
},
toString() {
return this.full;
},
/**
* Check if the current version is compatible with the passed in version
*
* @param {number|Version} v - the version, as a number or object with `major`
* and minor properties
* @return {Boolean}
*/
compatible(v) {
if (typeof v === 'number')
return this.valueOf() >= v && Math.floor(v/100) === this.major;
else
return this.major === v.major && this.minor >= v.minor;
},
/**
* Check if the given feature is present.
*
* It is ok to pass invalid or unrecognized feature names to this function,
* which will then return `false`.
*
* In this version of the library, the following feature names are recognized:
* - `rss`: RSS helpers and loaders
* - `value-types`: ThingTalk value types are re-exported
* - `thingpedia-client`: Thingpedia Client APIs are present
*
* @param {String} f - a feature name
* @return {Boolean} whether the named feature is supported.
*/
hasFeature(f) {
switch (f) {
case 'rss':
Expand Down
20 changes: 20 additions & 0 deletions jsdoc.json
@@ -0,0 +1,20 @@
{
"plugins": [
"plugins/markdown"
],
"recurseDepth": 10,
"source": {
"includePattern": ".+\\.js(doc|x)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"sourceType": "module",
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc","closure"]
},
"templates": {
"cleverLinks": true,
"monospaceLinks": true
}
}

0 comments on commit 5a65df3

Please sign in to comment.