import LifecycleWatcher from 'chrome-remote-interface-extra/lib/LifecycleWatcher.js'
LifecycleWatcher
An utility class that watches the supplied frame and its children (if any) to determine if they reach the specified lifecycle(s)
Lifecycle mapping in the form of supplied to CDP value:
- load: load
- domcontentloaded: DOMContentLoaded
- networkIdle: networkIdle
- networkAlmostIdle: networkAlmostIdle
- networkidle0: networkIdle
- networkidle2: networkAlmostIdle
Constructor Summary
Public Constructor | ||
public |
constructor(frameManager: FrameManager, frame: Frame, waitUntil: string | Array<string>, timeout: number) |
Member Summary
Private Members | ||
private |
_eventListeners: {emitter: !EventEmitter, eventName: (string|symbol), handler: (function(*))}[] |
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
A Promise that resolves if the frame being navigated reached the expected lifecycle |
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
A Promise that resolves if the frame being navigated navigated to a new page |
|
private |
|
|
private |
A Promise that resolves if the frame navigated within the same document (History.pushState etc) |
|
private |
|
|
private |
A Promise that resolves if the the watcher is terminated |
|
private |
|
|
private |
A Promise that resolves if the frame being navigated did not navigate within the supplied timeout if any |
Method Summary
Public Methods | ||
public |
dispose() Dispose of the LifecycleWatcher (i.e. |
|
public |
lifecyclePromise(): Promise<*> |
|
public |
|
|
public |
|
|
public |
|
|
public |
|
Private Methods | ||
private |
Checks the frame being navigated and all its child frames for the expected lifecycle(s) |
|
private |
|
|
private |
_navigatedWithinDocument(frame: Frame) |
|
private |
|
|
private |
_onFrameDetached(frame: Frame) |
|
private |
_onRequest(request: Request) |
|
private |
_terminate(error: Error) |
Public Constructors
public constructor(frameManager: FrameManager, frame: Frame, waitUntil: string | Array<string>, timeout: number) source
Params:
Name | Type | Attribute | Description |
frameManager | FrameManager |
|
The frame manager for the page containing the frame being navigated |
frame | Frame |
|
The frame being navigated |
waitUntil | string | Array<string> | The lifecycle(s) desired to be obtained by the frame and its children |
|
timeout | number |
|
An optional timeout value |
Private Members
private _eventListeners: {emitter: !EventEmitter, eventName: (string|symbol), handler: (function(*))}[] source
private _frameManager: FrameManager source
private _lifecycleCallback: * source
private _lifecyclePromise: Promise<*> source
A Promise that resolves if the frame being navigated reached the expected lifecycle
private _maximumTimer: * source
private _networkManager: NetworkManager source
private _newDocumentNavigationCompleteCallback: * source
private _newDocumentNavigationPromise: Promise<*> source
A Promise that resolves if the frame being navigated navigated to a new page
private _sameDocumentNavigationCompleteCallback: * source
private _sameDocumentNavigationPromise: Promise<*> source
A Promise that resolves if the frame navigated within the same document (History.pushState etc)
private _terminationCallback: * source
Public Methods
Private Methods
private _checkLifecycleComplete() source
Checks the frame being navigated and all its child frames for the expected lifecycle(s)
private _navigatedWithinDocument(frame: Frame) source
Params:
Name | Type | Attribute | Description |
frame | Frame |
|
private _onConnectionDisconnected() source
private _onFrameDetached(frame: Frame) source
Params:
Name | Type | Attribute | Description |
frame | Frame |
|