Checker
Extends:
Static Member Summary
| Static Public Members | ||
| public static get |
Returns application constants model |
|
| public static get |
Returns application default options |
|
Constructor Summary
| Public Constructor | ||
| public |
constructor(options: Object) Constructor |
|
Member Summary
| Public Members | ||
| public get |
Returns instance of LinkAnalyzer class |
|
| public get |
logger: Logger: * Returns logger instance |
|
| public get |
Returns model instance |
|
| public get |
options: BasedOptions: * Getter function for options |
|
| public get |
Returns instance of Statistic class |
|
| Private Members | ||
| private |
|
|
| private |
_model: * |
|
| private |
_options: BasedOptions Checker options |
|
| private |
_statistic: * |
|
Method Summary
| Public Methods | ||
| public |
initLinkAnalyzer(linkAnalyzer: LinkAnalyzer): Checker Sets linkAnalyzer instance |
|
| public |
Sets model instance |
|
| public |
initStatistic(statistic: Statistic): Checker Sets Statistic instance |
|
| public |
Start to crawl pages for given url |
|
| Protected Methods | ||
| protected |
onDone callback function |
|
| protected |
processLoadedDocument(document: Document) Processes loaded document |
|
| Private Methods | ||
| private |
_addToQueue(url: String, advanced: Object) Adds item to check queue |
|
| private |
_checkExternalLink(item: Object, attempt: Number): Promise Checks given external link item |
|
| private |
Check all collected external links |
|
| private |
_checkInternalLink(url: String, advanced: Object, attempt: Number) Makes request to given external url |
|
| private |
_getRequestOptions(): {encoding: string, headers: *, timeout: *} Returns request options hash |
|
| private |
_onFinishLoad(url: String): * Function which called after request to given url will be finished |
|
Static Public Members
Public Constructors
public constructor(options: Object) source
Constructor
Params:
| Name | Type | Attribute | Description |
| options | Object |
|
— configuration object |
| options.mode | String |
|
mode of checking ("website", "section" or "page") |
| options.concurrent | Number |
|
— number of concurrent requests |
| options.requestHeaders | Object |
|
— set custom request headers for crawler requests |
| options.requestRetriesAmount | Number |
|
number of attempts for request if it fails at first |
| options.requestTimeout | Number |
|
request timeout (in milliseconds) |
| options.onDone | Function |
|
set custom done handler function |
| options.acceptedSchemes | String[] |
|
— set array of accepted request acceptedSchemes |
| options.checkExternalUrls | Boolean |
|
— set |
| options.excludeLinkPatterns | RegExp[] |
|
array of regular expressions. Urls that matches for this regular expressions would be excluded from verification |
Public Members
Private Members
private _linkAnalyzer: * source
private _model: * source
private _statistic: * source
Public Methods
public initLinkAnalyzer(linkAnalyzer: LinkAnalyzer): Checker source
Sets linkAnalyzer instance
Params:
| Name | Type | Attribute | Description |
| linkAnalyzer | LinkAnalyzer |
public initModel(model: Model): Checker source
Sets model instance
Params:
| Name | Type | Attribute | Description |
| model | Model | instance |
public initStatistic(statistic: Statistic): Checker source
Sets Statistic instance
Params:
| Name | Type | Attribute | Description |
| statistic | Statistic |
public start(url: String) source
Start to crawl pages for given url
Params:
| Name | Type | Attribute | Description |
| url | String | initial site url for start |
Throw:
* |
Error |
Protected Methods
protected onDone(statistic: Statistic): * source
onDone callback function
Params:
| Name | Type | Attribute | Description |
| statistic | Statistic | model instance |
Return:
| * |
Private Methods
private _checkExternalLink(item: Object, attempt: Number): Promise source
Checks given external link item
private _checkInternalLink(url: String, advanced: Object, attempt: Number) source
Makes request to given external url