From 3438a5a37421b96af5ac8031ca86c394029357db Mon Sep 17 00:00:00 2001 From: rejas Date: Mon, 3 Aug 2020 11:36:29 +0200 Subject: [PATCH] Cleanup newsfeed jsdoc --- modules/default/newsfeed/newsfeed.js | 26 ++++++++++----------- modules/default/newsfeed/newsfeedfetcher.js | 22 +++++++++-------- modules/default/newsfeed/node_helper.js | 8 +++---- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/modules/default/newsfeed/newsfeed.js b/modules/default/newsfeed/newsfeed.js index 3e26da4f..2ff02888 100644 --- a/modules/default/newsfeed/newsfeed.js +++ b/modules/default/newsfeed/newsfeed.js @@ -205,8 +205,8 @@ Module.register("newsfeed", { return typeof this.newsItems[this.activeItem].url === "string" ? this.newsItems[this.activeItem].url : this.newsItems[this.activeItem].url.href; }, - /* registerFeeds() - * registers the feeds to be used by the backend. + /** + * Registers the feeds to be used by the backend. */ registerFeeds: function () { for (var f in this.config.feeds) { @@ -218,10 +218,10 @@ Module.register("newsfeed", { } }, - /* generateFeed() + /** * Generate an ordered list of items for this configured module. * - * attribute feeds object - An object with feeds returned by the node helper. + * @param {object} feeds An object with feeds returned by the node helper. */ generateFeed: function (feeds) { var newsItems = []; @@ -274,12 +274,11 @@ Module.register("newsfeed", { this.newsItems = newsItems; }, - /* subscribedToFeed(feedUrl) + /** * Check if this module is configured to show this feed. * - * attribute feedUrl string - Url of the feed to check. - * - * returns bool + * @param {string} feedUrl Url of the feed to check. + * @returns {boolean} True if it is subscribed, false otherwise */ subscribedToFeed: function (feedUrl) { for (var f in this.config.feeds) { @@ -291,12 +290,11 @@ Module.register("newsfeed", { return false; }, - /* titleForFeed(feedUrl) - * Returns title for a specific feed Url. + /** + * Returns title for the specific feed url. * - * attribute feedUrl string - Url of the feed to check. - * - * returns string + * @param {string} feedUrl Url of the feed + * @returns {string} The title of the feed */ titleForFeed: function (feedUrl) { for (var f in this.config.feeds) { @@ -308,7 +306,7 @@ Module.register("newsfeed", { return ""; }, - /* scheduleUpdateInterval() + /** * Schedule visual update. */ scheduleUpdateInterval: function () { diff --git a/modules/default/newsfeed/newsfeedfetcher.js b/modules/default/newsfeed/newsfeedfetcher.js index ba32d1ad..20e45258 100644 --- a/modules/default/newsfeed/newsfeedfetcher.js +++ b/modules/default/newsfeed/newsfeedfetcher.js @@ -9,12 +9,14 @@ const FeedMe = require("feedme"); const request = require("request"); const iconv = require("iconv-lite"); -/* Fetcher +/** * Responsible for requesting an update on the set interval and broadcasting the data. * - * attribute url string - URL of the news feed. - * attribute reloadInterval number - Reload interval in milliseconds. - * attribute logFeedWarnings boolean - Log warnings when there is an error parsing a news article. + * @param {string} url URL of the news feed. + * @param {number} reloadInterval Reload interval in milliseconds. + * @param {string} encoding Encoding of the feed. + * @param {boolean} logFeedWarnings If true log warnings when there is an error parsing a news article. + * @class */ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings) { const self = this; @@ -31,7 +33,7 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings /* private methods */ - /* fetchNews() + /** * Request the new items. */ const fetchNews = function () { @@ -95,7 +97,7 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings .pipe(parser); }; - /* scheduleTimer() + /** * Schedule the timer for the next update. */ const scheduleTimer = function () { @@ -107,10 +109,10 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings /* public methods */ - /* setReloadInterval() + /** * Update the reload interval, but only if we need to increase the speed. * - * attribute interval number - Interval for the update in milliseconds. + * @param {number} interval Interval for the update in milliseconds. */ this.setReloadInterval = function (interval) { if (interval > 1000 && interval < reloadInterval) { @@ -118,14 +120,14 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings } }; - /* startFetch() + /** * Initiate fetchNews(); */ this.startFetch = function () { fetchNews(); }; - /* broadcastItems() + /** * Broadcast the existing items. */ this.broadcastItems = function () { diff --git a/modules/default/newsfeed/node_helper.js b/modules/default/newsfeed/node_helper.js index 6aca2519..bdfcbfcc 100644 --- a/modules/default/newsfeed/node_helper.js +++ b/modules/default/newsfeed/node_helper.js @@ -24,12 +24,12 @@ module.exports = NodeHelper.create({ } }, - /* createFetcher(feed, config) + /** * Creates a fetcher for a new feed if it doesn't exist yet. * Otherwise it reuses the existing one. * - * attribute feed object - A feed object. - * attribute config object - A configuration object containing reload interval in milliseconds. + * @param {object} feed The feed object. + * @param {object} config The configuration object. */ createFetcher: function (feed, config) { const url = feed.url || ""; @@ -68,7 +68,7 @@ module.exports = NodeHelper.create({ fetcher.startFetch(); }, - /* broadcastFeeds() + /** * Creates an object with all feed items of the different registered feeds, * and broadcasts these using sendSocketNotification. */