This repository has been archived by the owner on Nov 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
request-timings.d.ts
151 lines (131 loc) · 5.14 KB
/
request-timings.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/**
* DO NOT EDIT
*
* This file was automatically generated by
* https://github.com/Polymer/tools/tree/master/packages/gen-typescript-declarations
*
* To modify these typings, edit the source file(s):
* request-timings.js
*/
// tslint:disable:variable-name Describing an API that's defined elsewhere.
// tslint:disable:no-any describes the API as best we are able today
import {LitElement, html, css} from 'lit-element';
declare namespace UiElements {
/**
* An element to display request timings information as a timeline according to the HAR 1.2 spec.
*
* The `timings` property should contain timings object as defined in
* [HAR 1.2 spec](https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HAR/Overview.html#sec-object-types-timings).
*
* The timings object is consisted of:
* - **blocked** [number, optional] - Time spent in a queue waiting for a network connection. Use -1 if the timing does not apply to the current request.
* - **dns** [number, optional] - DNS resolution time. The time required to resolve a host name. Use -1 if the timing does not apply to the current request.
* - **connect** [number, optional] - Time required to create TCP connection. Use -1 if the timing does not apply to the current request.
* - **send** [number] - Time required to send HTTP request to the server.
* - **wait** [number] - Waiting for a response from the server.
* - **receive** [number] - Time required to read entire response from the server (or cache).
* - **ssl** [number, optional] - Time required for SSL/TLS negotiation. If this field is defined then the time is also included in the connect field (to ensure backward compatibility with HAR 1.1). Use -1 if the timing does not apply to the current request.
*
* Additionally the object can contain the `startTime` property that indicates
* the request start time. If can be Date object, timestamp or formatted string
* representing a date.
*
* The timeline for `connect`, `send`, `wait` and `receive` are always shown.
* `blocked`, `dns` and `ssl` are visible only if values for it was set and value
* was > 0.
*
* ### Example
*
* ```html
* <request-timings timings="[[requestTimings]]"></request-timings>
* ```
*
* ### Styling
* `<request-timings>` provides the following custom properties and mixins for styling:
*
* Custom property | Description | Default
* ----------------|-------------|----------
* `--request-timings` | Mixin applied to the element | `{}`
* `--select-text` | Mixin applied to the text elements that should have text selection enabled (in some platforms text selection is disabled by default) | `{}`
* `--form-label` | Mixin applied to labels elements | `{}`
* `--request-timings-progress-height` | The height of the progress bar | `12px`
* `--request-timings-progress-background` | Background color of the progress bar. | `#F5F5F5`
* `--request-timings-progress-color` | Color of the progress bar. | `#4a4`
* `--request-timings-label-width` | Width of the label | `160px`
* `--request-timings-value-width` | Width of the value column | `120px`
*/
class RequestTimings extends LitElement {
/**
* A timings object as described in HAR 1.2 spec.
*/
timings: object|null|undefined;
/**
* Request stat time. It can be either Date object,
* timestamp or a string representing the date.
*
* If the `timings` property contains the `startTime` property it
* will be overwritten.
*/
_startTime: String|Date|null;
/**
* Computed value. Calculated full time of the request and response
*/
_fullTime: number|null|undefined;
/**
* Computed value. Time required to establish the connection
*/
_connect: number|null|undefined;
/**
* Computed value. Time of receiving data from the remote machine.
*/
_receive: number|null|undefined;
/**
* Computed value. Time to send data to the remote machine.
*/
_send: number|null|undefined;
/**
* Computed value. Wait time for the first byte to arrive.
*/
_wait: number|null|undefined;
/**
* Computed value. Time spent in a queue waiting for a network connection
*/
_blocked: number|null|undefined;
/**
* Computed value. DNS resolution time.
*/
_dns: number|null|undefined;
/**
* Computed value. Time required for SSL/TLS negotiation.
*/
_ssl: number|null|undefined;
constructor();
render(): any;
/**
* Updates the view after `timings` change.
*/
_update(): void;
/**
* Round numeric value to presision defined in the `power` argument.
*
* @param value The value to round
* @returns Rounded value.
*/
_round(value: Number|null): Number|null;
/**
* Sums two HAR times.
* If any argument is `undefined` or `-1` then `0` is assumed.
*
* @param a Time #1
* @param b Time #2
* @returns Sum of both
*/
_computeSum(a: Number|null, b: Number|null): Number|null;
_hasValue(num: any): any;
}
}
declare global {
interface HTMLElementTagNameMap {
"request-timings": UiElements.RequestTimings;
}
}