mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[@types/chrome]: Add HAREntry and HARLog to chrome.devtools.network (#43407)
This commit is contained in:
parent
633eb9e9d4
commit
65c25fecb7
6
types/chrome/har-format/index.d.ts
vendored
Normal file
6
types/chrome/har-format/index.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import { Entry, Log } from 'har-format';
|
||||
|
||||
declare global {
|
||||
export type HARFormatEntry = Entry;
|
||||
export type HARFormatLog = Log;
|
||||
}
|
||||
9
types/chrome/index.d.ts
vendored
9
types/chrome/index.d.ts
vendored
@ -14,6 +14,7 @@
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference types="filesystem" />
|
||||
/// <reference path="har-format/index.d.ts" />
|
||||
|
||||
////////////////////
|
||||
// Global object
|
||||
@ -1865,8 +1866,12 @@ declare namespace chrome.devtools.inspectedWindow {
|
||||
* Availability: Since Chrome 18.
|
||||
*/
|
||||
declare namespace chrome.devtools.network {
|
||||
/** Represents a HAR entry for a specific finished request. */
|
||||
export interface HAREntry extends HARFormatEntry { }
|
||||
/** Represents a HAR log that contains all known network requests. */
|
||||
export interface HARLog extends HARFormatLog { }
|
||||
/** Represents a network request for a document resource (script, image and so on). See HAR Specification for reference. */
|
||||
export interface Request {
|
||||
export interface Request extends chrome.devtools.network.HAREntry {
|
||||
/**
|
||||
* Returns content of the response body.
|
||||
* @param callback A function that receives the response body when the request completes.
|
||||
@ -1889,7 +1894,7 @@ declare namespace chrome.devtools.network {
|
||||
* function(object harLog) {...};
|
||||
* Parameter harLog: A HAR log. See HAR specification for details.
|
||||
*/
|
||||
export function getHAR(callback: (harLog: Object) => void): void;
|
||||
export function getHAR(callback: (harLog: HARLog) => void): void;
|
||||
|
||||
/** Fired when a network request is finished and all request data are available. */
|
||||
export var onRequestFinished: RequestFinishedEvent;
|
||||
|
||||
@ -439,3 +439,13 @@ function testStorage() {
|
||||
var myOldValue: { x: number } = changes["myKey"].oldValue;
|
||||
});
|
||||
}
|
||||
|
||||
chrome.devtools.network.onRequestFinished.addListener((request: chrome.devtools.network.Request) => {
|
||||
request; // $ExpectType Request
|
||||
console.log('request: ', request);
|
||||
});
|
||||
|
||||
chrome.devtools.network.getHAR((harLog: chrome.devtools.network.HARLog) => {
|
||||
harLog; // $ExpectType HARLog
|
||||
console.log('harLog: ', harLog)
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user