Methods
(async) clearLog()
Clear captured Network Monitor data
Example
let netmon = await instance.newNetworkMonitor();
netmon.clearLog();
disconnect()
Disconnect an network monitor connection. This is usually only required if a new network monitor connection has been created and is no longer needed
Example
netmon.disconnect();
(async) handleMessage(handler)
Set message handler
Example
let netmon = await instance.newNetworkMonitor();
netmon.handleMessage((message) => {
let host = message.request.headers.find(entry => entry.key === 'Host');
console.log(message.response.status, message.request.method, message.response.body.size, host.value);
});
Parameters:
Name | Type | Description |
---|---|---|
handler |
NetworkMonitor~newEntryCallback | the callback for captured entry |
(async) isEnabled() → {boolean}
Check if Network Monitor is enabled
Example
let enabled = await netmon.isEnabled();
if (enabled) {
console.log("enabled");
} else {
console.log("disabled");
}
Returns:
- Type
- boolean
(async) start()
Start Network Monitor
Example
let netmon = await instance.newNetworkMonitor();
netmon.start();
(async) stop()
Stop Network Monitor
Example
let netmon = await instance.newNetworkMonitor();
netmon.stop();
Type Definitions
newEntryCallback(entry)
A callback for file upload progress messages. Can be passed to NetworkMonitor#handleMessage
Example
let netmon = await instance.newNetworkMonitor();
netmon.handleMessage((message) => {
let host = message.request.headers.find(entry => entry.key === 'Host');
console.log(message.response.status, message.request.method, message.response.body.size, host.value);
});
Parameters:
Name | Type | Description |
---|---|---|
entry |
NetmonEntry | NetmonEntry object. |