NetIdleWatcher
Extends:
Monitors the HTTP requests made by a page and emits the 'network-idle' event when it has been determined the network is idle Used by PuppeteerCrawler
Static Method Summary
| Static Public Methods | ||
| public static | 
       idlePromise(page: Page, options: NetIdleOptions): Promise<void> Start monitoring the network and receive a Promise that resolves once network idle occurred or the global wait time has been reached  | 
    |
Constructor Summary
| Public Constructor | ||
| public | 
       constructor(page: Page, options: NetIdleOptions)  | 
    |
Member Summary
| Public Members | ||
| public | 
      
       The page object of the current page the crawler is visting  | 
    |
| Private Members | ||
| private | 
      
       Flag indicating if we are in a network tracking state of not  | 
    |
| private | 
      
       The id of the global crawler setTimeout timer  | 
    |
| private | 
      
       The number of in-flight requests there should be before starting the network-idle timer  | 
    |
| private | 
      
       The amount of time no new HTTP requests should be made before emitting the network-idle event  | 
    |
| private | 
      
       The id of the setTimeout for the network-idle timer  | 
    |
| private | 
       _pageListenrs: {emitter: !EventEmitter, eventName: string, handler: function()}[] An array of listeners registered on the page object  | 
    |
| private | 
      
       Set of the HTTP requests ids, used for tracking network-idle  | 
    |
| private | 
      
       Maximum amount of time a crawler going to visit a page  | 
    |
Method Summary
| Public Methods | ||
| public | 
       reqFinished(info: Response | Request) Indicate that a request has finished  | 
    |
| public | 
       reqStarted(info: Request) Indicate that a request was made  | 
    |
| public | 
       start() Setup the necessary listeners  | 
    |
| Private Methods | ||
| private | 
      
       Clear all timers  | 
    |
| private | 
      
       Emit the network-idle event  | 
    |
| private | 
      
       Called when the global time limit was hit  | 
    |
| private | 
      
       Called when the network idle has been determined  | 
    |
Static Public Methods
public static idlePromise(page: Page, options: NetIdleOptions): Promise<void> source
Start monitoring the network and receive a Promise that resolves once network idle occurred or the global wait time has been reached
Params:
| Name | Type | Attribute | Description | 
| page | Page | Puppeteer page object for the page being crawled  | 
    |
| options | NetIdleOptions | 
  | 
      Optional options to control fine tune network idle determination  | 
    
Public Constructors
public constructor(page: Page, options: NetIdleOptions) source
Params:
| Name | Type | Attribute | Description | 
| page | Page | Puppeteer page object for the page being crawled  | 
    |
| options | NetIdleOptions | 
  | 
      Optional options to control fine tune network idle determination  | 
    
Public Members
Private Members
private _idleInflight: number source
The number of in-flight requests there should be before starting the network-idle timer
private _idleTime: number source
The amount of time no new HTTP requests should be made before emitting the network-idle event
private _pageListenrs: {emitter: !EventEmitter, eventName: string, handler: function()}[] source
An array of listeners registered on the page object
Public Methods
public reqFinished(info: Response | Request) source
Indicate that a request has finished
Params:
| Name | Type | Attribute | Description | 
| info | Response | Request | Puppeteer Request or Response object  | 
    
public reqStarted(info: Request) source
Indicate that a request was made
Params:
| Name | Type | Attribute | Description | 
| info | Request | Puppeteer Request object  | 
    
  
  Reference
  Source
  
  
    
  