Skip to content

Commit

Permalink
doc: use @namespace not @module
Browse files Browse the repository at this point in the history
It looks better and avoids a lot of redundancy when documenting
  • Loading branch information
gcampax committed Oct 18, 2019
1 parent 8c860d9 commit 72855be
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 28 deletions.
8 changes: 4 additions & 4 deletions lib/helpers/content.js
Expand Up @@ -20,15 +20,15 @@ const HttpHelpers = require('./http');
* These APIs should be used in preference to other libraries to support platform-specific
* URLs, like `file:///` or `content://` URLs.
*
* @alias module:Helpers.Content
* @alias Helpers.Content
* @namespace
*/
module.exports = {
/**
* Check if the given URL is publicly accessible, that is, if it can be accessed on
* by a different server not running inside the current Almond.
*
* Use this method to skip calling {@link module:Helpers.Content.getStream} or similar APIs if the
* Use this method to skip calling {@link Helpers.Content.getStream} or similar APIs if the
* underlying API also support taking a URL instead of a data stream.
* This method returns `true` for private, pre-authenticated URLs.
*
Expand All @@ -47,7 +47,7 @@ module.exports = {
/**
* Stream the content of the given URL.
*
* This method to should be used in preference to {@link module:Helpers.Http} or other
* This method to should be used in preference to {@link Helpers.Http} or other
* libraries, in order to support platform-specific URLs.
*
* @param {BasePlatform} platform - the current Almond platform
Expand All @@ -73,7 +73,7 @@ module.exports = {
/**
* Buffer the content of the given URL.
*
* This method is identical to {@link module:Helpers.Content.getStream} but returns a `Buffer` instead of a `stream.Readable`.
* This method is identical to {@link Helpers.Content.getStream} but returns a `Buffer` instead of a `stream.Readable`.
*
* @param {BasePlatform} platform - the current Almond platform
* @param {string} url - the URL to retrieve
Expand Down
2 changes: 1 addition & 1 deletion lib/helpers/file_prefs.js
Expand Up @@ -17,7 +17,7 @@ const Preferences = require('../prefs');
/**
* A simple implementation of {@link Preferences} that uses a single file.
*
* @alias module:Helpers.FilePreferences
* @alias Helpers.FilePreferences
* @extends Preferences
*/
class FilePreferences extends Preferences {
Expand Down
4 changes: 2 additions & 2 deletions lib/helpers/http.js
Expand Up @@ -163,7 +163,7 @@ function httpDownloadStream(url, method, data, options) {
* HTTP Helpers.
*
* @namespace
* @alias module:Helpers.Http
* @alias Helpers.Http
*/
module.exports = {
/**
Expand Down Expand Up @@ -251,7 +251,7 @@ module.exports = {
/**
* Perform a stream HTTP POST request.
*
* The response will be buffered as with {@link module:Helpers.Http.post}.
* The response will be buffered as with {@link Helpers.Http.post}.
*
* @param {string} url - the URL to POST to
* @param {string|null} data - the content of the request body; you can pass `null` for an empty body
Expand Down
3 changes: 2 additions & 1 deletion lib/helpers/index.js
Expand Up @@ -15,7 +15,8 @@
* It is recommended, although not required, to use the following libraries
* instead of custom bundled libraries.
*
* @module Helpers
* @namespace
* @name Helpers
*/

module.exports = {
Expand Down
18 changes: 9 additions & 9 deletions lib/helpers/object_set.js
Expand Up @@ -14,19 +14,19 @@ const events = require('events');
/**
* The abstract interface that all ObjectSets must conform to.
*
* @memberof! module:Helpers.ObjectSet
* @memberof! Helpers.ObjectSet
*/
class Base extends events.EventEmitter {
/**
* Notifies that an object was to this set.
*
* @event module:Helpers.ObjectSet.Base#object-added
* @event Helpers.ObjectSet.Base#object-added
* @param {Object} object - the added object
*/
/**
* Notifies that an object was removed from this set.
*
* @event module:Helpers.ObjectSet.Base#object-removed
* @event Helpers.ObjectSet.Base#object-removed
* @param {Object} object - the just-removed object
*/

Expand All @@ -42,7 +42,7 @@ class Base extends events.EventEmitter {
* Report the addition of an object.
*
* @param {Object} o - the added object
* @fires module:Helpers.ObjectSet.Base#object-added
* @fires Helpers.ObjectSet.Base#object-added
* @protected
*/
objectAdded(o) {
Expand All @@ -53,7 +53,7 @@ class Base extends events.EventEmitter {
* Report the removal of an object.
*
* @param {Object} o - the removed object
* @fires module:Helpers.ObjectSet.Base#object-removed
* @fires Helpers.ObjectSet.Base#object-removed
* @protected
*/
objectRemoved(o) {
Expand Down Expand Up @@ -97,10 +97,10 @@ class Base extends events.EventEmitter {
}

/**
* A simple implementation of {@link module:Helpers.ObjectSet.Base} backed by a {@link Map}.
* A simple implementation of {@link Helpers.ObjectSet.Base} backed by a {@link Map}.
*
* @extends module:Helpers.ObjectSet.Base
* @memberof! module:Helpers.ObjectSet
* @extends Helpers.ObjectSet.Base
* @memberof! Helpers.ObjectSet
*/
class Simple extends Base {
constructor() {
Expand Down Expand Up @@ -193,7 +193,7 @@ class Simple extends Base {
* and removal.
*
* @namespace
* @alias module:Helpers.ObjectSet
* @alias Helpers.ObjectSet
*/
module.exports = {
Simple,
Expand Down
6 changes: 3 additions & 3 deletions lib/helpers/polling.js
Expand Up @@ -16,23 +16,23 @@ const stream = require('stream');
*
* The callback should poll the underlying API and return the current results.
*
* @callback module:Helpers~PollCallback
* @callback Helpers~PollCallback
* @return {Object[]} the current list of results
*/

/**
* A stream.Readable implementation that emits new values at specific interval.
*
* @extends stream.Readable
* @alias module:Helpers.PollingStream
* @alias Helpers.PollingStream
*/
class PollingStream extends stream.Readable {
/**
* Construct a new polling stream.
*
* @param {TriggerStateBinder} state - a state binder object
* @param {number} interval - polling interval, in milliseconds
* @param {module:Helpers~PollCallback} callback - function to call every poll interval
* @param {Helpers~PollCallback} callback - function to call every poll interval
*/
constructor(state, interval, callback) {
super({ objectMode: true });
Expand Down
4 changes: 2 additions & 2 deletions lib/helpers/ref_counted.js
Expand Up @@ -26,13 +26,13 @@ async function pFinally(promise, finallyClause) {
* a file or a socket) in a deterministic manner among multiple users.
*
* @extends events.EventEmitter
* @alias module:Helpers.RefCounted
* @alias Helpers.RefCounted
*/
class RefCounted extends events.EventEmitter {
/**
* Construct a new reference counted object.
*
* The object has initial reference count of 0. You must call {@link module:Helpers.RefCounted#open} before use.
* The object has initial reference count of 0. You must call {@link Helpers.RefCounted#open} before use.
*
* @protected
*/
Expand Down
8 changes: 4 additions & 4 deletions lib/helpers/rss.js
Expand Up @@ -16,7 +16,7 @@ const Http = require('./http');
/**
* RSS entry returned by the helpers.
*
* @typedef {Object} module:Helpers.Rss~RSSEntry
* @typedef {Object} Helpers.Rss~RSSEntry
* @property {string} guid - the GUID of the RSS entry
* @property {string} title - the title of the RSS entry
* @property {Date} updated_time - the time at which this RSS entry was updated
Expand All @@ -31,15 +31,15 @@ const Http = require('./http');
* RSS helpers.
*
* @namespace
* @alias module:Helpers.Rss
* @alias Helpers.Rss
*/
module.exports = {
/**
* Retrieve and parse and RSS feed.
*
* @param {string} url - the URL of the feed
* @param {Object} options - options to pass to the HTTP library; see {@link module:Helpers.Http.get} for details
* @return {Array.<module:Helpers.Rss~RSSEntry>} a list of RSS entries
* @param {Object} options - options to pass to the HTTP library; see {@link Helpers.Http.get} for details
* @return {Array.<Helpers.Rss~RSSEntry>} a list of RSS entries
* @async
*/
get(url, options) {
Expand Down
2 changes: 1 addition & 1 deletion lib/helpers/xml.js
Expand Up @@ -19,7 +19,7 @@ const util = require('util');
* dependency to Thingpedia interfaces, so that they don't need to bundle it themselves.
*
* @namespace
* @alias module:Helpers.Xml
* @alias Helpers.Xml
*/
module.exports = {
/**
Expand Down
2 changes: 1 addition & 1 deletion lib/prefs.js
Expand Up @@ -18,7 +18,7 @@ const events = require('events');
* consistency, durability or scalability. Use it only for small amounts of data
* that has little value.
*
* This is backed by {@link module:Helpers.FilePreferences} in most platforms, and by Android's `SharedPreferences`
* This is backed by {@link Helpers.FilePreferences} in most platforms, and by Android's `SharedPreferences`
* on Android.
*
* @extends events.EventEmitter
Expand Down

0 comments on commit 72855be

Please sign in to comment.