-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
499 additions
and
329 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
/** | ||
* @typedef {Object} FeedItem | ||
* @property {string} title Title of the feed item | ||
* @property {string} description description of the feed item | ||
* @property {string} summary summary on the feed item | ||
* @property {Date|null} date date the item "occurred" | ||
* @property {Date|null} pubdate Published date of the item | ||
* @property {string} link link to item relating to the feed | ||
* @property {string} origlink original link | ||
* @property {string} author author string | ||
* @property {string} guid globally unique identifying string | ||
* @property {string} comments comment string(s) | ||
* @property {Object} image Image, indeterminant format | ||
* @property {string} categories categories of the feed | ||
* @property {Object} enclosures | ||
* @property {Object} meta | ||
* @property {any} [x] String-keyed object. Various more are allowed than are representable | ||
*/ | ||
class FeedItem {} | ||
|
||
module.exports = FeedItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"inlcude": [ | ||
"src/**/*.js" | ||
], | ||
"exclude": [ | ||
"test/**/*.js", | ||
"types/**/*.*", | ||
"node_modules/**/*.*" | ||
], | ||
"compilerOptions": { | ||
"outDir": "./types", | ||
"declaration": true, | ||
"noEmit": false, | ||
"allowJs": true, | ||
"emitDeclarationOnly": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
export = Feed; | ||
/** | ||
* Storage object for properties of a feed | ||
* @typedef {Object} Feed | ||
* @property {string} url Feed url | ||
* @property {FeedItem[]} items items currently retrieved from the feed | ||
* @property {number} refresh timeout between refreshes | ||
* @property {string} userAgent User Agent string to fetch the feed with | ||
* @property {string} eventName event name to use when emitting this feed | ||
*/ | ||
declare class Feed { | ||
constructor(data: any); | ||
items: any[]; | ||
refresh: number; | ||
userAgent: string; | ||
/** | ||
* event name for this feed to emit when a new item becomes available | ||
* @type {String} | ||
*/ | ||
eventName: string; | ||
/** | ||
* Given a feed and item, try to find | ||
* it inside the feed item list. We will use | ||
* this to see if there's already an item inside | ||
* the feed item list. If there is, we know it's | ||
* not a new item. | ||
* @param {FeedItem} item item specitics | ||
* @returns {FeedItem} the matched element | ||
*/ | ||
findItem(item: import("./FeedItem")): import("./FeedItem"); | ||
/** | ||
* Update the maximum history length based on the length of a feed retrieval | ||
* @param {FeedItem[]} newItems new list of items to base the history length on | ||
* @mutator | ||
*/ | ||
updateHxLength(newItems: import("./FeedItem")[]): void; | ||
maxHistoryLength: number; | ||
/** | ||
* Add an item to the feed | ||
* @param {FeedItem} item Feed item. Indeterminant structure. | ||
*/ | ||
addItem(item: import("./FeedItem")): void; | ||
/** | ||
* Fetch the data for this feed | ||
* @returns {Promise} array of new feed items | ||
*/ | ||
fetchData(): Promise<any>; | ||
/** | ||
* Perform the feed parsing | ||
* @param {FeedParser} feedparser feedparser instance to use for parsing a retrieved feed | ||
*/ | ||
get(feedparser: import("feedparser")): void; | ||
/** | ||
* Private: handle errors inside the feed retrieval process | ||
* @param {Error} error error to be handled | ||
*/ | ||
handleError(error: Error): void; | ||
/** | ||
* Destroy feed | ||
*/ | ||
destroy(): void; | ||
} | ||
declare namespace Feed { | ||
export { Feed }; | ||
} | ||
/** | ||
* Storage object for properties of a feed | ||
*/ | ||
type Feed = { | ||
/** | ||
* Feed url | ||
*/ | ||
url: string; | ||
/** | ||
* items currently retrieved from the feed | ||
*/ | ||
items: import("./FeedItem")[]; | ||
/** | ||
* timeout between refreshes | ||
*/ | ||
refresh: number; | ||
/** | ||
* User Agent string to fetch the feed with | ||
*/ | ||
userAgent: string; | ||
/** | ||
* event name to use when emitting this feed | ||
*/ | ||
eventName: string; | ||
}; |
Oops, something went wrong.